166 lines
7.4 KiB
PHP
166 lines
7.4 KiB
PHP
<?php
|
|
namespace app\model;
|
|
use think\Db;
|
|
use think\db\Where;
|
|
|
|
class BocOfficialresult extends Base
|
|
{
|
|
/**
|
|
* 获取中国银行正式评估结果列表
|
|
* @Author llz
|
|
* @DateTime 2022-11-23
|
|
* @version 2.0
|
|
* @param array $field 查询字段值
|
|
* @param array $where 查询条件
|
|
* @param array $paginate 分页设置
|
|
* @return array
|
|
*/
|
|
public function getOfficialResultList($page,$limit){
|
|
|
|
//$where = new Where();
|
|
//if(!empty($postData['keyword'])) $where['name'] = ['like',['%'.trim($postData['keyword']).'%']];
|
|
//if(!empty($postData['bank_id'])) $where['bank_id'] = ['=',trim($postData['bank_id'])];
|
|
//if(!empty($postData['bank_branch_id'])) $where['bank_branch_id'] = ['=',trim($postData['bank_branch_id'])];
|
|
//if(!empty($postData['bank_sub_id'])) $where['bank_sub_id'] = ['=',trim($postData['bank_sub_id'])];
|
|
|
|
$res = Db::name('boc_officialresult')
|
|
->field('*,if(update_time,update_time,create_time) as time')
|
|
->order("time","desc")
|
|
//->where($where)
|
|
//->where(['is_delete'=>1])
|
|
// ->page($page)
|
|
// ->limit($limit)
|
|
->select();
|
|
return $res;
|
|
}
|
|
public function checkInquiryIsReady($pre_estimate_no) {
|
|
$res = Db::name('inquiry')
|
|
->field('id')
|
|
->where(['estimated_no'=>$pre_estimate_no])
|
|
->select();
|
|
return $res;
|
|
}
|
|
public function checkReportIsReady($quot_id) {
|
|
$res = Db::name('report')
|
|
->field('id')
|
|
->where(['quot_id'=>$quot_id])
|
|
->select();
|
|
return $res;
|
|
}
|
|
/**
|
|
* 组装中国银行正式评估结果
|
|
* @Author llz
|
|
* @DateTime 2022-11-23
|
|
* @version 2.0
|
|
* @param string $preEstimateNo 预评估编号
|
|
* @return object
|
|
*/
|
|
|
|
public function buildOfficialresult($report_inquiry_array) {
|
|
|
|
$reportid = $report_inquiry_array[0]['reportid'];
|
|
$res = Db::name('report')
|
|
->field('report_no,
|
|
appraisal_time,
|
|
appraiser_name,
|
|
appraiser2_name,
|
|
business_type
|
|
')
|
|
->where('id',$reportid)
|
|
->selectOrFail();
|
|
|
|
|
|
$list = array();
|
|
$len = count($report_inquiry_array);
|
|
for($x=0; $x < $len; $x++) {
|
|
$list[$x] = $report_inquiry_array[$x]['pre_estimate_no'];
|
|
}
|
|
|
|
$acOffHouseEstates = Db::name('inquiry')->alias('i')
|
|
->leftJoin('pg_report r','r.quot_id = i.id')
|
|
->leftJoin('pg_report_detail rd','rd.report_id = r.id')
|
|
->leftJoin('pg_property_cert_info iqd','iqd.quot_id = i.id')
|
|
->leftJoin('(select property_cert_info_id,eva_unit_price,eva_total_value,property_name,eva_net_value,
|
|
total_taxes1,corporate_income_tax,urban_construction_tax,deed_tax,stamp_duty,added_tax,
|
|
land_value_added_tax,personal_income_tax,external_remarks,guide_price,area,
|
|
total_guide_tax, create_time
|
|
from `pg_return_price` t1
|
|
where t1.create_time = (select max(create_time) as lastUpdate
|
|
from `pg_return_price` where property_cert_info_id =t1.property_cert_info_id)
|
|
|
|
) as rp', 'rp.property_cert_info_id=rd.property_cert_info_id')
|
|
->field('r.report_no,i.estimated_no,rd.building_name,rd.property_cert,rd.house_use,rd.parcel_no,rd.max_land_use_years,rd.land_use_start_time,
|
|
rd.land_use_end_time,rd.completion_date,iqd.reg_price,iqd.usage,rd.purchase_date,i.type,rd.building_area,iqd.city,
|
|
rd.obligee,rd.cert_no,rd.land_location,rd.floor_no,rd.building_no,iqd.property_full_name,
|
|
i.order_no,
|
|
i.id,
|
|
iqd.year,
|
|
rp.eva_unit_price,
|
|
rp.eva_total_value,
|
|
rp.eva_net_value,
|
|
rp.total_taxes1,
|
|
rp.corporate_income_tax,
|
|
rp.urban_construction_tax,
|
|
rp.deed_tax,
|
|
rp.stamp_duty,
|
|
rp.added_tax,
|
|
rp.land_value_added_tax,
|
|
rp.personal_income_tax,
|
|
rp.external_remarks,
|
|
rp.total_guide_tax,
|
|
rp.guide_price,
|
|
rp.area,
|
|
iqd.completion_time,
|
|
iqd.statutory_payment
|
|
')
|
|
->where('i.estimated_no','IN',$list)
|
|
->selectOrFail();
|
|
$competion_date = $acOffHouseEstates[0]['completion_date'] ;
|
|
$acOffHouseEstates[0]['completion_date'] = date('Y',strtotime($competion_date));
|
|
$res[0]['acOffHouseEstates'] = $acOffHouseEstates;
|
|
return $res[0];
|
|
}
|
|
|
|
public function deleteOfficialresult($bankEstimateNo) {
|
|
Db::name('boc_officialresult')->where('bank_estimate_no',$bankEstimateNo)->delete();
|
|
}
|
|
|
|
public function insertOfficialresult(array $data){
|
|
/* $
|
|
$tax_detail_str = json_encode(array('added_tax' => $data['data']['added_tax'],
|
|
'deed_tax' => $data['data']['deed_tax'],
|
|
'personal_income_tax' => $data['data']['personal_income_tax'],
|
|
'land_value_added_tax' => $data['data']['land_value_added_tax'],
|
|
'corporate_income_tax' => $data['data']['corporate_income_tax'],
|
|
'total_guide_tax' => $data['data']['total_guide_tax'],
|
|
'urban_construction_tax' => $data['data']['urban_construction_tax']));
|
|
*/
|
|
Db::startTrans();
|
|
$this->timestamp = time();//date('Y-m-d H:i:s');
|
|
$this->bank_estimate_no = $data['uploadfile']['bankEstimateNo'];
|
|
$this->estimated_no = $data['report_no'];
|
|
$this->file_index = $data['uploadfile']['url'];
|
|
$this->file_url = $data['uploadfile']['url'];
|
|
$this->eval_time = $data['appraisal_time'];
|
|
$this->appraisers = $data['appraiser_name'] . ',' . $data['appraiser2_name'];
|
|
$this->assessment_type = $data['assessmentType'];
|
|
$this->ac_off_house_estates = json_encode($data['acOffHouseEstates']);
|
|
$this->quot_id = $data['acOffHouseEstates'][0]['id'];//增加一个
|
|
|
|
$this->upload_file_id = $data['uploadfile']['id'];
|
|
$this->upload_file_name = $data['uploadfile']['name'];
|
|
$this->upload_file_ext = $data['uploadfile']['ext'];
|
|
$this->upload_file_url = $data['uploadfile']['url'];
|
|
|
|
$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;
|
|
}
|
|
}
|
|
?>
|