first commit
This commit is contained in:
195
pgserver/application/model/CebCheckResult.php
Normal file
195
pgserver/application/model/CebCheckResult.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
namespace app\model;
|
||||
use think\Db;
|
||||
use think\db\Where;
|
||||
use app\lib\AuthApi;
|
||||
use think\Cache;
|
||||
|
||||
class CebCheckResult extends Base
|
||||
{
|
||||
//获取用户列表
|
||||
public function getUserList()
|
||||
{
|
||||
$userList = cache('userList');
|
||||
if (!$userList ) {
|
||||
$Auth = new AuthApi();
|
||||
$user_list = $Auth->getUserList();
|
||||
$ret = json_decode($user_list,true);
|
||||
if($ret['code'] == 200){
|
||||
cache('userList',$ret['data']);
|
||||
return $ret['data'];
|
||||
}else {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return $userList;
|
||||
|
||||
}
|
||||
public function getUserPhone($nickname) {
|
||||
$userList = $this->getUserList();
|
||||
$arrlen = count($userList);
|
||||
$phone ='unknown';
|
||||
for ($i = 0; $i < $arrlen; $i += 1) {
|
||||
if ($userList[$i]['userNickName'] == $nickname){
|
||||
$phone = $userList[$i]['phonenumber'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取中国光大银行核价结果列表
|
||||
* @Author llz
|
||||
* @DateTime 2023-03-21
|
||||
* @version 2.0
|
||||
* @param array $field 查询字段值
|
||||
* @param array $where 查询条件
|
||||
* @param array $paginate 分页设置
|
||||
* @return array
|
||||
*/
|
||||
public function getCheckResultList($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('ceb_check_result')->alias('ccr')
|
||||
|
||||
->leftJoin('pg_inquiry pi','pi.business_no = ccr.business_no')
|
||||
->leftJoin('pg_property_cert_info pid','pid.quot_id= pi.id')
|
||||
->field('ccr.*,if(ccr.update_time,ccr.update_time,ccr.create_time) as time')
|
||||
->field('pid.property_full_name,pi.bank_name,pi.bank_sub_name,pi.bank_customer_mgr_name')
|
||||
->order("time","desc")
|
||||
//->where($where)
|
||||
// ->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;
|
||||
}
|
||||
|
||||
public function buildFailedCheckResult($businessNo, $inquiryNo, $companyCode,$reason) {
|
||||
$ret['business_no'] = $businessNo;
|
||||
$ret['company_code'] = $companyCode;
|
||||
$ret['estimate_deal_no'] = $companyCode . $inquiryNo;
|
||||
$ret['check_total_price'] = "0";
|
||||
$ret['check_charge_amt'] = "0";
|
||||
$ret['check_net_worth'] = "0";
|
||||
$ret['check_time'] = date('Y-m-d H:i:s');
|
||||
$ret['reason'] = $reason;
|
||||
$ret['check_status'] = '04';
|
||||
$ret['handle_status'] = '2';
|
||||
return $ret;
|
||||
}
|
||||
/**
|
||||
* 组装中国光大银行核价价结果
|
||||
* businessNo 业务编号 VARCHAR(32) Y 唯一索引
|
||||
*companyCode 评估公司编号 VARCHAR(10) Y
|
||||
* estimateDealNo 评估交易编号 VARCHAR(32) Y
|
||||
* checkTotalPrice 核价评估总价 NUMBER(18,2) Y 失败填0
|
||||
* checkChargeAmt 核价收费金额 NUMBER(18,2) Y 该笔业务评估预计支付费用,失败填0
|
||||
* checkStatus 核价状态 VARCHAR(2) Y "03-核价成功
|
||||
* 04-核价失败"
|
||||
* field1 预留字段1 VARCHAR(100) N
|
||||
* field2 预留字段2 VARCHAR(100) N
|
||||
* field3 预留字段3 VARCHAR(100) N
|
||||
* checkTime 核价时间 timestamp(6) Y 评估公司返回核价结果时的系统时间
|
||||
|
||||
|
||||
* @Author llz
|
||||
* @DateTime 2023-03-13
|
||||
* @version 2.0
|
||||
* @param string $preEstimateNo 预评估编号
|
||||
* @return object
|
||||
*/
|
||||
|
||||
public function buildCheckResult($businessNo, $inquiryNo, $companyCode) {
|
||||
$res = Db::name('inquiry')->alias('i')
|
||||
->leftJoin('pg_property_cert_info d', 'i.id=d.quot_id')
|
||||
->leftJoin('(select property_cert_info_id,eva_total_value,eva_total_value,
|
||||
appraiser_name, create_time
|
||||
from `pg_return_price` t1
|
||||
INNER JOIN (select max(create_time) as lastUpdate
|
||||
from `pg_return_price`
|
||||
GROUP BY property_cert_info_id) t2 ON t2.lastUpdate = t1.create_time
|
||||
) as rp', 'rp.property_cert_info_id=d.id')
|
||||
->field('i.order_no,
|
||||
rp.eva_total_value,
|
||||
rp.eva_total_value,
|
||||
rp.appraiser_name,
|
||||
rp.create_time
|
||||
')
|
||||
->where('i.order_no',$inquiryNo)
|
||||
->selectOrFail();
|
||||
$res = $res[0];
|
||||
|
||||
$ret['business_no'] = $businessNo;
|
||||
$ret['company_code'] = $companyCode;
|
||||
$ret['estimate_deal_no'] = $companyCode . $inquiryNo;
|
||||
$ret['check_total_price'] = strval($res['eva_total_value']);
|
||||
$ret['check_net_worth'] = strval($res['eva_total_value']);
|
||||
$ret['check_charge_amt'] = "600.00";
|
||||
$ret['check_time'] = date('Y-m-d H:i:s',$res['create_time']);
|
||||
$ret['check_status'] = '03';
|
||||
$ret['handle_status'] = '2';
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function deleteCheckResult($businessNo) {
|
||||
Db::name('ceb_check_result')->where('business_no',$businessNo)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* businessNo 业务编号 VARCHAR(32) Y 唯一索引
|
||||
* companyCode 评估公司编号 VARCHAR(10) Y
|
||||
* estimateDealNo 评估交易编号 VARCHAR(32) Y
|
||||
* checkTotalPrice 核价评估总价 NUMBER(18,2) Y 失败填0
|
||||
* checkChargeAmt 核价收费金额 NUMBER(18,2) Y 该笔业务评估预计支付费用,失败填0
|
||||
* checkStatus 核价状态 VARCHAR(2) Y "03-核价成功
|
||||
* 04-核价失败"
|
||||
* field1 预留字段1 VARCHAR(100) N
|
||||
* field2 预留字段2 VARCHAR(100) N
|
||||
* field3 预留字段3 VARCHAR(100) N
|
||||
* checkTime 核价时间 timestamp(6) Y 评估公司返回核价结果时的系统时间
|
||||
|
||||
*/
|
||||
public function insertCheckResult($data){
|
||||
Db::startTrans();
|
||||
$this->business_no = $data['business_no'];
|
||||
$this->company_code = $data['company_code'];
|
||||
$this->estimate_deal_no = $data['estimate_deal_no'];
|
||||
|
||||
$this->check_total_price = $data['check_total_price'];
|
||||
$this->check_charge_amt = $data['check_charge_amt'];
|
||||
$this->check_status = $data['check_status'];
|
||||
|
||||
$this->check_time = $data['check_time'];
|
||||
$this->handle_status = $data['handle_status'];
|
||||
$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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user