Commit 4624d246 authored by hujun's avatar hujun

Merge remote-tracking branch 'origin/wx0604' into wx0604

parents 570256a8 4cb1519c
...@@ -69,13 +69,13 @@ class Performance extends Basic ...@@ -69,13 +69,13 @@ class Performance extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/*$params = array( $params = array(
"agent_id" => 9, "agent_id" => 9,
"start_time" => "2018-04-13", "start_time" => "2018-06-20",
"end_time" => "2018-06-18", "end_time" => "2018-06-20",
"is_case" => 1,//1经纪人 2案场 "is_case" => 1,//1经纪人 2案场
"house_id" => 0 "house_id" => 0
);*/ );
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["is_case"])) { if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["is_case"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -361,14 +361,14 @@ class Performance extends Basic ...@@ -361,14 +361,14 @@ class Performance extends Basic
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"type" => 1, //1个人,2经纪人 "type" => 1, //1个人,2经纪人
"agent_id" => 80, "agent_id" => 80,
"start_time" => "2018-06-12", "start_time" => "2018-06-12",
"end_time" => "2018-06-19", "end_time" => "2018-06-19",
"page_no" => 1, "page_no" => 1,
"page_size" => 15 "page_size" => 15
);*/ );*/
$checkResult = $this->validate($params, "PerformanceValidate.verify"); $checkResult = $this->validate($params, "PerformanceValidate.verify");
if (true !== $checkResult) { if (true !== $checkResult) {
...@@ -381,7 +381,7 @@ class Performance extends Basic ...@@ -381,7 +381,7 @@ class Performance extends Basic
$page_no = empty($params['page_no']) ? 1 : $params['page_no']; $page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size']; $page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->performanceList($params["type"],$params["agent_id"], $start_day, $end_day, $page_no, $page_size); $result = $this->service_->performanceList($params["type"], $params["agent_id"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) { if ($result["code"] == 101) {
return $this->response("101", $result["date"]); return $this->response("101", $result["date"]);
} else { } else {
...@@ -390,20 +390,20 @@ class Performance extends Basic ...@@ -390,20 +390,20 @@ class Performance extends Basic
} }
/** /**
* 获取时间段进场数据 * 获取时间段监督执行数据
* @return \think\Response * @return \think\Response
*/ */
public function superviseList() public function superviseList()
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
$params = array( /* $params = array(
"agent_id" => 78, "agent_id" => 78,
"start_time" => "2018-06-12", "start_time" => "2018-06-12",
"end_time" => "2018-06-20", "end_time" => "2018-06-20",
"page_no" => 1, "page_no" => 1,
"page_size" => 15 "page_size" => 15
); );*/
$checkResult = $this->validate($params, "PerformanceValidate.verifyOther"); $checkResult = $this->validate($params, "PerformanceValidate.verifyOther");
if (true !== $checkResult) { if (true !== $checkResult) {
...@@ -423,4 +423,40 @@ class Performance extends Basic ...@@ -423,4 +423,40 @@ class Performance extends Basic
return $this->response("200", "success", $result["date"]); return $this->response("200", "success", $result["date"]);
} }
} }
/**
* 获取时间段实收数据
* @return \think\Response
*/
public function officialReceiptsList()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "PerformanceValidate.verify");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
//默认排序一周
$end_day = !empty($params["end_time"]) ? $params["end_time"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_time"]) ? $params["start_time"] : date("Y-m-d", strtotime("-7 day"));
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->officialReceipts($params["type"], $params["agent_id"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
return $this->response("200", "success", $result["date"]);
}
}
} }
...@@ -300,39 +300,46 @@ class PerformanceService ...@@ -300,39 +300,46 @@ class PerformanceService
if ($type == 1) { if ($type == 1) {
//房源 //房源
$addHouseNum = $this->houseModel->getAddHouseNum($params); $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); $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表示实收 $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->getAddBargainNum($params, 2);//1表示业绩 2表示实收 $receivedSum = $this->bargainModel->getReceived($params);
$result["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0; $result["official_receipts"] = !empty($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
} }
$reportNum = $this->reportModel->getAddReportNum($params); $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); $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); $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);//表示统计 $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; 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) public function storePerformance($agent_id, $start_time, $end_time)
{ {
//获取经纪人信息
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]); $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]);
// dump($result);
if (count($result) <= 0) { if (count($result) <= 0) {
return null; return null;
} }
...@@ -491,7 +498,7 @@ class PerformanceService ...@@ -491,7 +498,7 @@ class PerformanceService
$performanceSum = $this->bargainModel->getAddBargainNum($params, 1);//1表示业绩 2表示实收 $performanceSum = $this->bargainModel->getAddBargainNum($params, 1);//1表示业绩 2表示实收
$result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0; $result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//实收 //实收
$receivedSum = $this->bargainModel->getAddBargainNum($params, 2);//1表示业绩 2表示实收 $receivedSum = $this->bargainModel->getReceived($params);
$result["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0; $result["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
//dump($receivedSum); //dump($receivedSum);
//约带看 //约带看
...@@ -509,8 +516,8 @@ class PerformanceService ...@@ -509,8 +516,8 @@ class PerformanceService
$payLogNum = $this->payLogModel->getAddPayLogNum($params); $payLogNum = $this->payLogModel->getAddPayLogNum($params);
$result["paylog"] = isset($payLogNum[0]["num"]) ? $payLogNum[0]["num"] : 0; $result["paylog"] = isset($payLogNum[0]["num"]) ? $payLogNum[0]["num"] : 0;
//dump($payLogNum); //dump($payLogNum);
//todo 监督 // 监督
$result["supervision_num"] = 0; $result["supervision_num"] = $this->superviseModel->findSuperviseListCount("id", $params);
return $result; return $result;
} }
...@@ -718,4 +725,28 @@ class PerformanceService ...@@ -718,4 +725,28 @@ class PerformanceService
} }
return [ "code" => 200, "date" => $superviseList ]; return [ "code" => 200, "date" => $superviseList ];
} }
/**
* 获取实收记录
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public function officialReceipts($type, $agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, $type, $start_time, $end_time);
if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,c.name,d.store_name,e.district_name,b.practical_fee,b.create_time";
$where_["a.agent_id"] = $params["agent_id"];
$where_["a.create_time"] = $params["create_time"];
$receivedList = $this->bargainModel->getReceivedList($page_no, $page_size, $field, $where_);
return [ "code" => 200, "date" => $receivedList ];
}
} }
\ No newline at end of file
...@@ -59,4 +59,26 @@ class ASuperviseModel extends Model ...@@ -59,4 +59,26 @@ class ASuperviseModel extends Model
return $result; 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
...@@ -546,6 +546,35 @@ class OBargainModel extends Model ...@@ -546,6 +546,35 @@ class OBargainModel extends Model
return $data; 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.practical_fee) 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 $params
* @param $type * @param $type
...@@ -563,7 +592,8 @@ class OBargainModel extends Model ...@@ -563,7 +592,8 @@ class OBargainModel extends Model
} elseif ($type == 2) { } elseif ($type == 2) {
$field = "sum(practical_fee) as num,DATE(create_time) as day"; $field = "sum(practical_fee) as num,DATE(create_time) as day";
} elseif ($type == 3) { } 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"])) { if (isset($params["agent_id"])) {
...@@ -580,7 +610,6 @@ class OBargainModel extends Model ...@@ -580,7 +610,6 @@ class OBargainModel extends Model
->select(); ->select();
} }
public function getAddBargainNum($params, $type) public function getAddBargainNum($params, $type)
{ {
$where_ = []; $where_ = [];
...@@ -614,6 +643,56 @@ class OBargainModel extends Model ...@@ -614,6 +643,56 @@ class OBargainModel extends Model
->select(); ->select();
} }
public function getReceived($params)
{
$where_ = [];
$field = "sum(b.practical_fee) 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 getReceivedList($page_no, $page_size, $field, $params)
{
$where_ = [];
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")
->join("a_agents c", "a.agent_id=c.id", "left")
->join("a_store d", "c.store_id=d.id", "left")
->join("a_district e", "c.district_id=e.id", "left")
->where($where_)
->page($page_no)
->limit($page_size)
->select();
// echo $this->getLastSql();
return $date;
}
public function getAddBargainList($params, $field, $page_no, $page_size) public function getAddBargainList($params, $field, $page_no, $page_size)
{ {
$where_ = []; $where_ = [];
......
...@@ -468,7 +468,8 @@ Route::group('broker', [ ...@@ -468,7 +468,8 @@ Route::group('broker', [
'marchInList' => [ 'api_broker/Performance/marchInList', [ 'method' => 'POST|GET' ] ], //进场list 'marchInList' => [ 'api_broker/Performance/marchInList', [ 'method' => 'POST|GET' ] ], //进场list
'paylogList' => [ 'api_broker/Performance/paylogList', [ 'method' => 'POST|GET' ] ], //收款list 'paylogList' => [ 'api_broker/Performance/paylogList', [ 'method' => 'POST|GET' ] ], //收款list
'performanceList' => [ 'api_broker/Performance/performanceList', [ 'method' => 'POST|GET' ] ], //业绩list 'performanceList' => [ 'api_broker/Performance/performanceList', [ 'method' => 'POST|GET' ] ], //业绩list
'superviseList' => [ 'api_broker/Performance/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行list 'superviseList' => [ 'api_broker/Performance/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行list
'officialReceiptsList' => [ 'api_broker/Performance/officialReceiptsList', [ 'method' => 'POST|GET' ] ], //实收list
//user //user
'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ 'method' => 'get' ] ], //客户搜索条件 'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ 'method' => 'get' ] ], //客户搜索条件
......
...@@ -4,6 +4,7 @@ namespace app\task\controller; ...@@ -4,6 +4,7 @@ namespace app\task\controller;
use app\extra\RedisExt; use app\extra\RedisExt;
use app\model\AAgents; use app\model\AAgents;
use app\model\ASuperviseModel;
use app\model\GHouses; use app\model\GHouses;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\OMarchInModel; use app\model\OMarchInModel;
...@@ -30,6 +31,7 @@ class ResultsSummaryTask ...@@ -30,6 +31,7 @@ class ResultsSummaryTask
private $reportModel; private $reportModel;
private $marchInModel; private $marchInModel;
private $payLogModel; private $payLogModel;
private $superviseModel;
private $redis_; private $redis_;
function __construct() function __construct()
...@@ -43,6 +45,7 @@ class ResultsSummaryTask ...@@ -43,6 +45,7 @@ class ResultsSummaryTask
$this->marchInModel = new OMarchInModel(); $this->marchInModel = new OMarchInModel();
$this->payLogModel = new OPayLogModel(); $this->payLogModel = new OPayLogModel();
$this->redis_ = RedisExt::getRedis(); $this->redis_ = RedisExt::getRedis();
$this->superviseModel = new ASuperviseModel();
} }
public function totalAgentResults() public function totalAgentResults()
...@@ -130,7 +133,7 @@ class ResultsSummaryTask ...@@ -130,7 +133,7 @@ class ResultsSummaryTask
// dump($performanceSum); // dump($performanceSum);
$result_arr["performance_sum"] = $this->foreachResult($performanceSum); $result_arr["performance_sum"] = $this->foreachResult($performanceSum);
//实收 //实收
$receivedSum = $this->bargainModel->getAddBargainNumGroupTime($params, 2);//1表示业绩 2表示实收 $receivedSum = $this->bargainModel->getReceivedGroupTime($params);
$result_arr["received_sum"] = $this->foreachResult($receivedSum); $result_arr["received_sum"] = $this->foreachResult($receivedSum);
//dump($receivedSum); //dump($receivedSum);
//约带看 //约带看
...@@ -148,8 +151,9 @@ class ResultsSummaryTask ...@@ -148,8 +151,9 @@ class ResultsSummaryTask
$payLogNum = $this->payLogModel->getAddPayLogNumGroupTime($params); $payLogNum = $this->payLogModel->getAddPayLogNumGroupTime($params);
$result_arr["pay_log_num"] = $this->foreachResult($payLogNum); $result_arr["pay_log_num"] = $this->foreachResult($payLogNum);
//dump($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);//表示统计 $bargainSum = $this->bargainModel->getAddBargainNumGroupTime($params, 3);//表示统计
......
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>同联商业</title><script type=text/javascript src=./vconsole.min.js></script><script type=text/javascript>if(~location.origin.indexOf('api.tonglianjituan.com')){console.log('正式服')}else{var vConsole=new VConsole()};</script><link href=./static/css/app.750242cf94fc6a1c837832b2967fa5df.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.94d51f6620cb57f6116c.js></script><script type=text/javascript src=./static/js/app.7f39005f105af47b007a.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>同联商业</title><script type=text/javascript src=./static/js/vconsole.min.js></script><script type=text/javascript>if(~location.origin.indexOf('api.tonglianjituan.com')){console.log('正式服')}else{var vConsole=new VConsole()};</script><link href=./static/css/app.bdcc04a45cadafdc77909e93ec95a501.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3ad1d5771e9b13dbdad2.js></script><script type=text/javascript src=./static/js/vendor.94d51f6620cb57f6116c.js></script><script type=text/javascript src=./static/js/app.f120a21e98360c1f7bb3.js></script></body></html>
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment