Commit 42a3d28c authored by clone's avatar clone

1

parent d4fd721a
...@@ -5,6 +5,7 @@ namespace app\api_broker\service; ...@@ -5,6 +5,7 @@ namespace app\api_broker\service;
use app\api\untils\GeTuiUtils; use app\api\untils\GeTuiUtils;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\OfficeGRoom;
use app\model\OfficeOrderModel; use app\model\OfficeOrderModel;
use app\model\OfficeOReportModel; use app\model\OfficeOReportModel;
use app\model\Users; use app\model\Users;
...@@ -24,8 +25,8 @@ class OfficeReportService ...@@ -24,8 +25,8 @@ class OfficeReportService
function __construct() function __construct()
{ {
$this->reportModel = new OfficeOReportModel(); $this->reportModel = new OfficeOReportModel();
$this->orderModel = new OfficeOrderModel(); $this->orderModel = new OfficeOrderModel();
} }
/** /**
...@@ -42,9 +43,9 @@ class OfficeReportService ...@@ -42,9 +43,9 @@ class OfficeReportService
if (count($userArr) > 0) { if (count($userArr) > 0) {
$userResult["user_phone"] = $userArr["user_phone"]; $userResult["user_phone"] = $userArr["user_phone"];
if (empty($userArr['user_name'])) { if (empty($userArr['user_name'])) {
$userResult["user_name"] = $userArr["user_nick"]; $userResult["user_name"] = $userArr["user_nick"];
} else { } else {
$userResult["user_name"] = $userArr["user_name"]; $userResult["user_name"] = $userArr["user_name"];
} }
} else { } else {
return null; return null;
...@@ -83,7 +84,7 @@ class OfficeReportService ...@@ -83,7 +84,7 @@ class OfficeReportService
foreach ($house_arr as $k => $v) { foreach ($house_arr as $k => $v) {
//todo 批量插入到数据库 //todo 批量插入到数据库
if($v <= 0){ if ($v <= 0) {
break; break;
} }
$order_no = $this->createOrderNumber(); $order_no = $this->createOrderNumber();
...@@ -109,9 +110,9 @@ class OfficeReportService ...@@ -109,9 +110,9 @@ class OfficeReportService
{ {
//todo 获取我报备的我的案场的, //todo 获取我报备的我的案场的,
//如果是店长则获取其下所有的经纪人 这里去掉了for190218 //如果是店长则获取其下所有的经纪人 这里去掉了for190218
$vModel = new VerifyService(); $vModel = new VerifyService();
// $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]); // $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
$params["agent_id_s"] = array( "in", $params["report_agent_id"] ); $params["agent_id_s"] = array("in", $params["report_agent_id"]);
$caseHouseId = $vModel->getCaseHouseIdByAgentIdV2($params["agent_id_s"]); $caseHouseId = $vModel->getCaseHouseIdByAgentIdV2($params["agent_id_s"]);
$ids = ""; $ids = "";
...@@ -137,25 +138,26 @@ class OfficeReportService ...@@ -137,25 +138,26 @@ class OfficeReportService
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function returnResult($result){ public function returnResult($result)
$ids_str = ""; {
$ids_str = "";
$house_id_str = ""; $house_id_str = "";
if (count($result) > 0) { if (count($result) > 0) {
foreach ($result as $k => $v) { foreach ($result as $k => $v) {
$order_id = 0; $order_id = 0;
if(isset($v["order_id"])){ if (isset($v["order_id"])) {
$order_id = $v["order_id"]; $order_id = $v["order_id"];
}else{ } else {
$order_id = $v["id"]; $order_id = $v["id"];
} }
$ids_str .= $order_id . ","; $ids_str .= $order_id . ",";
$house_id_str .= $v["house_id"] . ","; $house_id_str .= $v["house_id"] . ",";
} }
$ids_str = rtrim($ids_str, ","); $ids_str = rtrim($ids_str, ",");
$house_id_str = rtrim($house_id_str, ","); $house_id_str = rtrim($house_id_str, ",");
$sign_arr = $this->orderSign($ids_str); $sign_arr = $this->orderSign($ids_str);
$house_arr = $this->houseInfo($house_id_str); $house_arr = $this->houseInfo($house_id_str);
foreach ($result as $k => $v) { foreach ($result as $k => $v) {
...@@ -173,8 +175,9 @@ class OfficeReportService ...@@ -173,8 +175,9 @@ class OfficeReportService
} }
} }
return $result; return $result;
} }
/** /**
* 报备订单列表All * 报备订单列表All
* @param $field * @param $field
...@@ -185,9 +188,9 @@ class OfficeReportService ...@@ -185,9 +188,9 @@ class OfficeReportService
* @throws \think\db\exception\BindParamException * @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function orderListAll($field, $params, $pageNo, $pageSize,$check_type) public function orderListAll($field, $params, $pageNo, $pageSize, $check_type)
{ {
$vModel = new VerifyService(); $vModel = new VerifyService();
$result = []; $result = [];
switch ($check_type) { switch ($check_type) {
case 1 : case 1 :
...@@ -195,19 +198,19 @@ class OfficeReportService ...@@ -195,19 +198,19 @@ class OfficeReportService
break; break;
case 2 : case 2 :
case 3 : case 3 :
$agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type); $agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type);
$params["agent_id_s"] = array( "in", $agentArr); $params["agent_id_s"] = array("in", $agentArr);
$params["report_agent_id"] = $agentArr; $params["report_agent_id"] = $agentArr;
$caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]); $caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]);
$ids = ""; $ids = "";
if (count($caseHouseId) > 0) { if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) { foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ","; $ids .= $item["houses_id"] . ",";
} }
} }
$ids = rtrim($ids, ","); $ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0; $ids = $ids ? $ids : 0;
$params["house_ids"] = $ids; $params["house_ids"] = $ids;
$result = $this->reportModel->selectReportList($field, $params, $pageNo, $pageSize); $result = $this->reportModel->selectReportList($field, $params, $pageNo, $pageSize);
...@@ -234,7 +237,7 @@ class OfficeReportService ...@@ -234,7 +237,7 @@ class OfficeReportService
$vModel = new VerifyService(); $vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]); $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
if ($agentArr) { if ($agentArr) {
$params["agent_id_s"] = array( "in", $agentArr ); $params["agent_id_s"] = array("in", $agentArr);
$params["report_agent_id"] = $agentArr; $params["report_agent_id"] = $agentArr;
} }
...@@ -251,11 +254,11 @@ class OfficeReportService ...@@ -251,11 +254,11 @@ class OfficeReportService
$params["house_ids"] = $ids; $params["house_ids"] = $ids;
$result = $this->reportModel->selectReportList($field, $params, $pageNo, $pageSize); $result = $this->reportModel->selectReportList($field, $params, $pageNo, $pageSize);
$count = $this->reportModel->selectReportCount($field,$params); $count = $this->reportModel->selectReportCount($field, $params);
if (count($result) > 0) { if (count($result) > 0) {
$data["result"] = $this->returnResult($result); $data["result"] = $this->returnResult($result);
$data["total"] = $count[0]["total"] ? $count[0]["total"] : 0; $data["total"] = $count[0]["total"] ? $count[0]["total"] : 0;
return $data; return $data;
} }
return null; return null;
...@@ -276,9 +279,9 @@ class OfficeReportService ...@@ -276,9 +279,9 @@ class OfficeReportService
*/ */
public function houseInfo($house_id_str) public function houseInfo($house_id_str)
{ {
$houseModel = new GHouses(); $houseModel = new GHouses();
$params["id"] = array("in",($house_id_str)); $params["id"] = array("in", ($house_id_str));
return $houseModel->getHouseInfo("id,internal_address",$params); return $houseModel->getHouseInfo("id,internal_address", $params);
} }
public function signTitle($type) public function signTitle($type)
...@@ -352,9 +355,9 @@ class OfficeReportService ...@@ -352,9 +355,9 @@ class OfficeReportService
*/ */
private function orderBin($order_no, $f_id, $house_id) private function orderBin($order_no, $f_id, $house_id)
{ {
$houseModel = new GHouses(); $roomModel = new OfficeGRoom();
$houseResult = $houseModel->getHouseDetail("id,internal_title", [ "id" => $house_id ]); $houseResult = $roomModel->getHouseDetail("a.id,c.title,c.address,a.room_number", ["id" => $house_id]);
$house_title = count($houseResult) > 0 && isset($houseResult["internal_title"]) ? $houseResult["internal_title"] : null; $house_title = count($houseResult) > 0 ? $houseResult["address"] . " " . $houseResult["room_number"] : null;
$param["order_no"] = $order_no; $param["order_no"] = $order_no;
$param["f_id"] = $f_id; $param["f_id"] = $f_id;
$param["house_id"] = $house_id; $param["house_id"] = $house_id;
...@@ -373,15 +376,15 @@ class OfficeReportService ...@@ -373,15 +376,15 @@ class OfficeReportService
public function getCheckType($agent_id) public function getCheckType($agent_id)
{ {
$vip = new VipService(); $vip = new VipService();
if($vip->vip($agent_id, 'index/inspectionRecordAll/3') == 0){//代表公司 if ($vip->vip($agent_id, 'index/inspectionRecordAll/3') == 0) {//代表公司
return 1; return 1;
} }
if($vip->vip($agent_id, 'index/inspectionRecordDistrict/2') == 0){//代表部门 if ($vip->vip($agent_id, 'index/inspectionRecordDistrict/2') == 0) {//代表部门
return 2; return 2;
} }
if($vip->vip($agent_id, 'index/inspectionRecordStore/1') == 0){//代表门店 if ($vip->vip($agent_id, 'index/inspectionRecordStore/1') == 0) {//代表门店
return 3; return 3;
} }
return 0; return 0;
......
...@@ -418,4 +418,22 @@ class OfficeGRoom extends BaseModel ...@@ -418,4 +418,22 @@ class OfficeGRoom extends BaseModel
->page($pageNo) ->page($pageNo)
->select(); ->select();
} }
/**
* @param $field
* @param $params
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getHouseDetail($field, $params)
{
return $data = $this
->field($field)
->alias("a")
->join("office_g_building b","a.building_id=a.id")
->where($params)
->find();
}
} }
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