228 lines
6.4 KiB
PHP
228 lines
6.4 KiB
PHP
<?php
|
|
namespace app\model;
|
|
use think\Db;
|
|
use think\db\Where;
|
|
|
|
class CebReportApply extends Base
|
|
{
|
|
|
|
const BUSINESS_TYPE_PRE_EVATION = '03';
|
|
|
|
|
|
// 未回价
|
|
public static $IS_RETURN_NO = 1;
|
|
|
|
// 已回价
|
|
public static $IS_RETURN_YES = 2;
|
|
|
|
// /**
|
|
// * 获取光大银行报告申请列表
|
|
// * @Author owen
|
|
// * @DateTime 2023-03-10
|
|
// * @version 2.0
|
|
// * @param array $field 查询字段值
|
|
// * @param array $where 查询条件
|
|
// * @param array $paginate 分页设置
|
|
// * @return array
|
|
// */
|
|
// public function getReportApplyList($page,$limit,$Inquiry_id){
|
|
//
|
|
// $where = new Where();
|
|
//
|
|
// //暂时未处理Inquiry_id
|
|
// $res = Db::name('ceb_report_apply')->where($where)->select();
|
|
// /*
|
|
// $res = Db::name('ceb_report_apply')->alias('a')
|
|
// ->leftJoin('ceb_inquiry_result b', 'a.business_no=b.business_no')
|
|
// ->leftJoin('property_cert_info c', 'c.quot_id=b.quot_id')
|
|
// ->leftJoin('inquiry d', 'd.id=b.quot_id')
|
|
// ->field('c.property_full_name,
|
|
// b.quot_id,
|
|
// b.business_no,
|
|
// a.file_name,
|
|
// d.bank_name,
|
|
// d.bank_sub_name,
|
|
// d.bank_customer_mgr_name,
|
|
// a.is_done,
|
|
// if(a.update_time,a.update_time,a.create_time) as time')
|
|
// ->order("time","desc")
|
|
// ->where($where)
|
|
// // ->page($page)
|
|
// // ->limit($limit)
|
|
// ->select();
|
|
// // var_dump($res);*/
|
|
// return $res;
|
|
//}
|
|
|
|
/**
|
|
* 获取新报告请求数量
|
|
*
|
|
* @return void
|
|
*/
|
|
public function getNewReportCount()
|
|
{
|
|
return Db::name('ceb_report_apply')->where(['is_done'=>'1'])->count();
|
|
}
|
|
|
|
/**
|
|
* 获取业务号关联的评估/报告申请
|
|
* @Author llz
|
|
* @DateTime 2023-06-09
|
|
* @version 2.0
|
|
* @param array $field 查询字段值
|
|
* @param array $where 查询条件
|
|
* @param array $paginate 分页设置
|
|
* @return array
|
|
*/
|
|
public function getReportApply($page,$limit,$handle_status,$business_no,$business_type){
|
|
$where = new Where();
|
|
if($business_type != '1') {
|
|
$where['cra.business_type'] = $business_type;
|
|
}
|
|
|
|
$where['cra.business_no'] = $business_no;
|
|
|
|
$res = Db::name('ceb_report_apply')->alias('cra')
|
|
->leftJoin('pg_inquiry pi','pi.business_no = cra.business_no')
|
|
->leftJoin('pg_property_cert_info pid','pid.quot_id= pi.id')
|
|
->field('cra.*,if(cra.update_time,cra.update_time,cra.create_time) as time')
|
|
->field('pid.property_full_name,pi.bank_name,pi.bank_sub_name,pi.bank_customer_mgr_name')
|
|
->order('is_done','asc')
|
|
->order("time","desc")
|
|
->where($where)
|
|
// ->page($page)
|
|
// ->limit($limit)
|
|
->select();
|
|
return $res;
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取正式评估申请列表
|
|
* @Author llz
|
|
* @DateTime 2022-11-23
|
|
* @version 2.0
|
|
* @param array $field 查询字段值
|
|
* @param array $where 查询条件
|
|
* @param array $paginate 分页设置
|
|
* @return array
|
|
*/
|
|
public function getReportApplylist2C($page,$limit,$handle_status,$business_no,$business_type){
|
|
$where = new Where();
|
|
if($business_type != '1') {
|
|
$where['cra.business_type'] = $business_type;
|
|
}
|
|
if($business_no != '1') {
|
|
$where['cra.business_no'] = $business_no;
|
|
}
|
|
$res = Db::name('ceb_report_apply')->alias('cra')
|
|
->leftJoin('pg_inquiry pi','pi.business_no = cra.business_no')
|
|
->leftJoin('pg_property_cert_info pid','pid.quot_id= pi.id')
|
|
->field('cra.*,if(cra.update_time,cra.update_time,cra.create_time) as time')
|
|
->field('pid.property_full_name,pi.bank_name,pi.bank_sub_name,pi.bank_customer_mgr_name')
|
|
->order('is_done','asc')
|
|
->order("time","desc")
|
|
->where($where)
|
|
// ->page($page)
|
|
// ->limit($limit)
|
|
->select();
|
|
return $res;
|
|
|
|
}
|
|
|
|
/**
|
|
* 获取基本信息
|
|
*
|
|
* @param [type] $quot_id 询价号
|
|
* @return 返回多条记录
|
|
*/
|
|
private function getBasicInfo( $quot_id ) {
|
|
$res = Db::name('inquiry')->alias('i')
|
|
->leftJoin('pg_property_cert_info d', 'i.id=d.quot_id')
|
|
->field('i.bank_sub_name,
|
|
i.bank_name,
|
|
i.bank_customer_mgr_name,
|
|
d.quot_id,
|
|
d.property_full_name')
|
|
->where('i.id',$quot_id)
|
|
->select();
|
|
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* updateIsDone函数参数 已完成
|
|
*/
|
|
public const STATUS_IS_DONE_YES = 2;
|
|
|
|
/**
|
|
* updateIsDone函数参数 未完成
|
|
*/
|
|
public const STATUS_IS_DONE_NO = 1;
|
|
|
|
/**
|
|
* 更新报告状态
|
|
*
|
|
* @param [type] $business_no
|
|
* @param [type] $IsDone 枚举[ STATUS_IS_DONE_NO ; STATUS_IS_DONE_YES ]
|
|
* @return void
|
|
*/
|
|
public function updateIsDoneByBusinessNo($business_no, $business_type, $is_done) {
|
|
$where = new Where();
|
|
$where['business_no'] = $business_no;
|
|
$where['business_type'] = $business_type;
|
|
$res = Db::name('ceb_report_apply')->where($where)
|
|
->update(['is_done' => $is_done]);
|
|
}
|
|
|
|
public function addReportApply(array $data){
|
|
Db::startTrans();
|
|
|
|
$this->business_no = $data['businessNo'];
|
|
$this->company_code = $data['companyCode'];
|
|
$this->estimate_deal_no = $data['estimateDealNo'];
|
|
$this->business_type = $data['businessType'];
|
|
|
|
if (isset($data['fileName'])) {
|
|
$this->file_name = $data['fileName'];
|
|
}
|
|
if (isset($data['fileEnd'])) {
|
|
$this->file_end = $data['fileEnd'];
|
|
}
|
|
if (isset($data['filePath'])) {
|
|
$this->file_path = $data['filePath'];
|
|
}
|
|
if (isset($data['field1'])) {
|
|
$this->field1 = $data['field1'];
|
|
}
|
|
if (isset($data['field2'])) {
|
|
$this->field2 = $data['field2'];
|
|
}
|
|
if (isset($data['field3'])) {
|
|
$this->field3 = $data['field3'];
|
|
}
|
|
|
|
if (isset($data['createTime']))
|
|
{
|
|
$this->create_date = $data['createTime'];
|
|
}
|
|
|
|
$this->is_return = CebReportApply::$IS_RETURN_NO;
|
|
|
|
$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;
|
|
}
|
|
|
|
public function getReportTotal(){
|
|
return Db::name('ceb_report_apply')->where('is_done=1')->count();
|
|
}
|
|
|
|
}
|
|
?>
|