This commit is contained in:
unknown 2023-09-05 15:04:58 +08:00
parent 79ac7be63f
commit 6196c10e56
3 changed files with 35 additions and 6 deletions

View File

@ -146,8 +146,11 @@ class IndexController extends BaseApiController
} }
return json(['success' => true, 'msg' => '成功']); return json(['success' => true, 'msg' => '成功']);
} else if ($contract['signing_timer'] == 1) { } else if ($contract['signing_timer'] == 1) {
//获取签约后的合同
$signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
$signContractFile = $signContractFile ?? '';
//更改合同状态 //更改合同状态
VehicleContract::where('id', $id)->update(['signing_timer' => 2, 'status' => 3]); VehicleContract::where('id', $id)->update(['signing_timer' => 2, 'status' => 3,'contract_url'=>$signContractFile]);
//添加车辆到租赁列表 //添加车辆到租赁列表
$vehicle = json_decode($contract['cars_info'], true); $vehicle = json_decode($contract['cars_info'], true);
VehicleRent::where('car_id', $vehicle['id'])->update([ VehicleRent::where('car_id', $vehicle['id'])->update([
@ -216,7 +219,10 @@ class IndexController extends BaseApiController
return json(['success' => false, 'msg' => '失败2.6']); return json(['success' => false, 'msg' => '失败2.6']);
} }
$cars_info = json_encode(['id' => $curl_res['data']['car_id'], 'license' => $vehicle['license']]); $cars_info = json_encode(['id' => $curl_res['data']['car_id'], 'license' => $vehicle['license']]);
VehicleContract::where('id', $id)->update(['cars_info' => $cars_info, 'update_time' => time(), 'signing_timer' => 2, 'status' => 3]); //获取签约后的合同
$signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
$signContractFile = $signContractFile ?? '';
VehicleContract::where('id', $id)->update(['cars_info'=>$cars_info,'update_time'=>time(),'signing_timer'=>2,'status'=>3,'contract_url'=>$signContractFile]);
VehicleRent::create([ VehicleRent::create([
'car_id' => $curl_res['data']['car_id'], 'car_id' => $curl_res['data']['car_id'],
'contract_id' => $contract['id'], 'contract_id' => $contract['id'],
@ -276,8 +282,11 @@ class IndexController extends BaseApiController
} }
return json(['success' => true, 'msg' => '成功']); return json(['success' => true, 'msg' => '成功']);
} else if ($contract['signing_timer'] == 1) { } else if ($contract['signing_timer'] == 1) {
//获取签约后的合同
$signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
$signContractFile = $signContractFile ?? '';
//更改合同状态 //更改合同状态
VehicleContract::where('id', $id)->update(['signing_timer' => 2, 'status' => 3]); VehicleContract::where('id', $id)->update(['signing_timer'=>2,'status'=>3,'contract_url'=>$signContractFile]);
//更改租赁列表车辆状态 //更改租赁列表车辆状态
$vehicle = json_decode($contract['cars_info'], true); $vehicle = json_decode($contract['cars_info'], true);
//获取租赁车辆信息 //获取租赁车辆信息

View File

@ -2,6 +2,7 @@
namespace app\api\controller; namespace app\api\controller;
use app\common\model\contract\VehicleContract;
use app\Request; use app\Request;
use junziqian\sdk\bean\req\sign\ApplySignReq; use junziqian\sdk\bean\req\sign\ApplySignReq;
use junziqian\sdk\bean\req\user\OrganizationCreateReq; use junziqian\sdk\bean\req\user\OrganizationCreateReq;
@ -191,6 +192,25 @@ class JunziqianController extends BaseApiController
return $response; return $response;
} }
public function downloadVehicleContractFile($applyNo) {
$requestUtils = new RequestUtils($this->serviceUrl, $this->appkey, $this->appSecret);
$contract_url = VehicleContract::where('contract_no', $applyNo)->value('contract_url');
if ($contract_url && !empty($contract_url)) {
return $contract_url;
}
//初始化请求参数
$request = array(
"applyNo" => $applyNo, //TODO +
);
$response = $requestUtils->doPost("/v2/sign/linkFile", $request);
if ($response->success) {
$this->getDownload($response->data, root_path() . 'public/uploads/vehicle_contract/' . $applyNo . '.pdf');
return env('project.website_domain').'/uploads/vehicle_contract/' . $applyNo . '.pdf';
} else {
return false;
}
}
public function SigningLink($data) public function SigningLink($data)
{ {
//构建请求工具 //构建请求工具

View File

@ -418,7 +418,7 @@ class VehicleController extends BaseApiController
if($data['status'] == 2){ if($data['status'] == 2){
$data['company'] = Company::field('company_name,master_name as user_name,master_phone as user_phone,province,city,area,street,village,brigade')->where('id',$data['rent_company_id'])->find()->append(['province_name', 'city_name', 'area_name', 'street_name', 'village_name','brigade_name']); $data['company'] = Company::field('company_name,master_name as user_name,master_phone as user_phone,province,city,area,street,village,brigade')->where('id',$data['rent_company_id'])->find()->append(['province_name', 'city_name', 'area_name', 'street_name', 'village_name','brigade_name']);
//获取合同 //获取合同
$data['contract'] = VehicleContract::field('id,contract_no,file,status,create_time,update_time')->where('id',$data['contract_id'])->findOrEmpty(); $data['contract'] = VehicleContract::field('id,contract_no,contract_url,file,status,create_time,update_time')->where('id',$data['contract_id'])->findOrEmpty();
} }
//当前坐标位置 //当前坐标位置
$position = curl_get(env('project.logistic_domain').'/api/getCarLocal?car_id='.$carId); $position = curl_get(env('project.logistic_domain').'/api/getCarLocal?car_id='.$carId);
@ -503,7 +503,7 @@ class VehicleController extends BaseApiController
'status' => -1, 'status' => -1,
'create_time' => time(), 'create_time' => time(),
'update_time' => time(), 'update_time' => time(),
'old_file' => $contract['file'], 'old_file' => $contract['contract_url'],
]; ];
//写入数据 //写入数据
$result = VehicleContract::create($data); $result = VehicleContract::create($data);
@ -523,7 +523,7 @@ class VehicleController extends BaseApiController
if($company['company_type'] != 16){ if($company['company_type'] != 16){
return $this->fail('非镇街公司不能访问'); return $this->fail('非镇街公司不能访问');
} }
$data = VehicleContract::field('id,contract_no,file,status,create_time,update_time')->where('contract_logistic_id','<>',0)->where('company_b_id',$company['id'])->select(); $data = VehicleContract::field('id,contract_no,contract_url,status,create_time,update_time')->where('contract_logistic_id','<>',0)->where('company_b_id',$company['id'])->select();
return $this->success('请求成功',$data->toArray()); return $this->success('请求成功',$data->toArray());
} }