Files
pgserver3.0/pgserver/application/model/BocApplyofficial.php
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

156 lines
5.4 KiB
PHP

<?php
namespace app\model;
use think\Db;
use think\db\Where;
class BocApplyofficial extends Base
{
/**
* 获取中国银行正式评估申请列表
* @Author llz
* @DateTime 2022-11-23
* @version 2.0
* @param array $field 查询字段值
* @param array $where 查询条件
* @param array $paginate 分页设置
* @return array
*/
public function getApplyOfficialList($page,$limit,$handle_status,$keyword){
$paginate = [
'list_rows' => $limit,
'page' => $page
];
$where = new Where();
if($handle_status != 'all') {
$where['ao.handle_status'] = $handle_status;
}
if($keyword != '') {
$where['d.property_name'] = ['like', '%'. $keyword .'%'];
}
$res = Db::name('boc_applyofficial')->alias('ao')
->field('ao.*,if(ao.update_time,ao.update_time,ao.create_time) as time')
->leftJoin('pg_boc_preresult i','ao.pre_estimate_no_list like concat(\'%\',i.pre_estimate_no,\'%\') and i.pre_estimate_no <> ""')
->leftJoin('pg_boc_preapply d', 'i.bank_pre_estimate_no=d.bank_pre_estimate_no')
->field('d.banker_branch AS bank_sub_name,
d.banker_phone AS bank_customer_mgr_phone,
d.banker_name AS bank_customer_mgr_name,
i.property_name AS property_full_name')
->order("ao.handle_status ASC, time desc")
->where($where)
->where('ao.update_time','>','2023-08-15')
->paginate($paginate);
$data = $res->items();
// foreach ($data as $i => $e_no) {
// // code...
// $preEstimateNo_list = json_decode($data[$i]['pre_estimate_no_list'],true);
// foreach( $preEstimateNo_list as $k => $v )
// {
// $r = $this->getBasicInfo( $v );
// if( count($r) <= 0 )
// {
// continue;
// }
// //$info = $this->getBasicInfo( $v )[0];
// $IqInfo = $this->getInquiryInfo($v);
// $data[$i]['property_full_name'] = $this->getInquiryDetailInfo( $IqInfo['id'] )['property_full_name'];//物业全称数组
// $data[$i]['bank_sub_name'] = $IqInfo['bank_sub_name'];//支行数组
// $data[$i]['bank_customer_mgr_name'] = $IqInfo['bank_customer_mgr_name'];//客户经理数据组
// $data[$i]['bank_customer_mgr_phone'] = $IqInfo['bank_customer_mgr_phone'];//客户经理电话数据组
// }
// }
$total = $res->total()?$res->total():0;
$ret = ['total'=>$total,'data'=>$data];
return $ret;
}
/**
* 获取询价信息
*
* @param [string] $preEstimateNo
* @return row
*/
private function getInquiryInfo( $preEstimateNo )
{
return Db::name('inquiry')
->field('id, bank_sub_name, bank_customer_mgr_phone, bank_customer_mgr_name')
->where('estimated_no',$preEstimateNo)
->find();
}
/**
* 获取询价详细-物业的属性
*
* @param [type] $quot_id
* @return row
*/
private function getInquiryDetailInfo( $quot_id )
{
return Db::name('property_cert_info')
->field('property_full_name')
->where('quot_id',$quot_id )
->find();
}
/**
* 获取基本信息
*
* @param [type] $preEstimateNo 预估号
* @return 返回多条记录
*/
private function getBasicInfo( $preEstimateNo ) {
$res = Db::name('inquiry')->alias('i')
->leftJoin('pg_property_cert_info d', 'i.id=d.quot_id')
->field('i.bank_sub_name,
i.bank_customer_mgr_phone,
i.bank_customer_mgr_name,
d.property_full_name')
->where('i.estimated_no',$preEstimateNo)
->select();
return $res;
}
public function updateApplyofficialStatus($bankPreEstimateNo,$status) {
$res = Db::name('boc_applyofficial')->where('bank_estimate_no', $bankPreEstimateNo)
->update(['handle_status' => $status]);
}
/**
*
* 通过bank_estimate_no预估号 获取 目前订单处理状态
*/
public function getApplyofficialStatus( $bankPreEstimateNo )
{
$res = Db::name('boc_applyofficial')->where('pre_estimate_no_list', 'like', "%{$bankPreEstimateNo}%")
->value('handle_status');
return $res;
}
public function addApplyOfficial(array $data){
Db::startTrans();
$this->bank_estimate_no = $data['bankEstimateNo'];
$this->pre_estimate_no_list = $data['preEstimateNoList'];
$this->callback_url = $data['callBackUrl'];
$this->company_code = $data['companyCode'];
$this->is_return_report = $data['isReturnReport'];
$this->handle_status = '0';
$this->assessment_type = $data['assessmentType'];
//$this->system_remark = $data['systemRemark'];
$this->timestamp = time();//date('Y-m-d H:i:s',$data['timestamp']/1000);
$this->create_time = date('Y-m-d H:i:s');
$this->update_time = date('Y-m-d H:i:s');
if (!$this->save()){
Db::rollback();
return false;
}
Db::commit();
return true;
}
}
?>