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

139 lines
6.4 KiB
PHP

<?php
namespace app\model;
use think\Db;
use think\db\Where;
class BocPreresult extends Base
{
/**
* 获取中国银行预评估结果列表
* @Author llz
* @DateTime 2022-11-23
* @version 2.0
* @param array $field 查询字段值
* @param array $where 查询条件
* @param array $paginate 分页设置
* @return array
*/
public function getPreResultList($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_preresult')
->field('*,if(update_time,update_time,create_time) as time')
->order("time","desc")
->where("handle_status is null")
//->where($where)
//->where(['is_delete'=>1])
// ->page($page)
// ->limit($limit)
->select();
return $res;
}
/**
* 组装中国银行预评估结果
* @Author llz
* @DateTime 2022-11-23
* @version 2.0
* @param string $preEstimateNo 预评估编号
* @return object
*/
public function buildPreresult($preEstimateNo) {
$res = Db::name('inquiry')->alias('i')
->leftJoin('pg_property_cert_info d', 'i.id=d.quot_id')
->leftJoin('(select property_cert_info_id,eva_unit_price,eva_total_value,property_name,eva_total_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,
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=d.id')
->field('i.estimated_no,
d.size,
d.completion_time,
d.land_location,
d.obligee,
rp.eva_unit_price,
rp.eva_total_value,
rp.property_name,
d.usage,
d.owner_name,
d.statutory_payment,
rp.eva_total_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.guide_price,
i.user_name,
rp.total_guide_tax,
i.eva_purpose
')
->where('i.estimated_no',$preEstimateNo)
->selectOrFail();
return $res;
}
public function deletePreresult($bankPreEstimateNo) {
Db::name('boc_preresult')->where('bank_pre_estimate_no',$bankPreEstimateNo)->delete();
}
public function insertPreresult(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->eva_unit_price = $data['data']['eva_unit_price'];
$this->eva_total_value = $data['data']['eva_total_value'];
$this->pre_estimate_no = $data['data']['estimated_no'];
$this->assessment_type = $data['assessmentType'];
$this->price = $data['data']['eva_total_value'];
$this->fileContent = $data['data']['guide_price'];
$this->owner_name = $data['data']['owner_name'];
$this->property_name = $data['data']['property_name'];
$this->land_location = $data['data']['land_location'];
$this->finished_year = $data['data']['finished_year'];
$this->room_area = $data['data']['size'];
$this->stamp_duty = $data['data']['stamp_duty'];
$this->tax = $data['data']['total_taxes1'];
$this->tax_detail = $tax_detail_str;
$this->property_use = $data['data']['usage'];
$this->appraisers = $data['data']['user_name'];
$this->total_taxes1 = $data['data']['total_taxes1'];
$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->bank_pre_estimate_no = $data['data']['bankPreEstimateNo'];
$this->create_time = date('Y-m-d H:i:s');
$this->update_time = date('Y-m-d H:i:s');
$this->timestamp = $data['data']['timestamp'];
if (!$this->save()){
Db::rollback();
return false;
}
Db::commit();
return true;
}
}
?>