From fe632c8cc69153ad8dcdbe373e420e373a817dda Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 23 May 2022 14:03:37 +0530 Subject: [PATCH] CreditPD json key added 1 : ps --- api/application/controllers/PD_Controller.php | 54 ++++++++- api/application/helpers/faceapi_helper.php | 106 ++++++++++++++++++ .../helpers/smc_creditpd_helper.php | 6 +- 3 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 api/application/helpers/faceapi_helper.php diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 1c9ca3d5..b714a7a8 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -38,6 +38,7 @@ class PD_Controller extends REST_Controller { $this->load->helper('MYUTIL'); $this->load->helper('satellite_image'); $this->load->library('pdfgenerator'); + $this->load->helper('faceapi'); //$this->load->library('excel'); $this->load->library('phpmailer_library'); @@ -11862,6 +11863,57 @@ public function getCompaniesListsFromGeneralFormRawJSONV2_post() } $this->response($data,REST_Controller::HTTP_OK); } - + public function facemark_get(){ + $get = $this->get('pd');//pdid 3184 + $bounding_box = array(); + if(!empty($get)){ + $master_details = $this->PD_Model->getPDMasterDetails($get); + if($master_details[0]['pd_status'] !== COMPLETED){ + $db_result = $this->PD_Model->selectCustomRecords(array('faceapi_result'),array('pd_id' => $get),PDTRIGGER); + $string = $db_result[0]['faceapi_result']; + // echo gettype($string); + $my_array = json_decode($string,true); + // echo gettype($my_array); + if(!empty($my_array) && !empty($my_array["FaceMatches"])){ + $arr = $my_array["FaceMatches"]; + for($i=0;$i $get,'isactive' => 1,'image_key' => "selfie_with_person_met"); + $img_result = $this->PD_Model->selectCustomRecords(array('pd_document_id','pd_document_name','pd_document_title','image_key'),$where_condition_array,PDDOCUMENTS); + $image_name = $img_result[0]['pd_document_name']; + $bucketname = LENDER_BUCKET_NAME_PREFIX.$master_details[0]['fk_lender_id']; + $key = 'pd'.$get.'/'.$image_name; + + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + $destination_path = $this->external_path."/pd_reports/". $get ."/".$image_name; + //$getimage = getcontent first ($singed_uri) + $image_name = file_put_contents($destination_path, file_get_contents($singed_uri)); + // $image_name = "sample.png"; + // $destination_path = $this->external_path."/pd_reports/". $get ."/".$image_name; + + faceapi::toMakeFaceBoundingBox($image_name,$bounding_box,$destination_path); + // save table s3 + + + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['msg'] = 'Given PDID '; + $data['details'] = $bounding_box; + }else{ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'Given PDID is Not in Completed Status'; + } + }else{ + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['msg'] = 'PDID is Not Available'; + } + $this->response($data,REST_Controller::HTTP_OK); + + } } \ No newline at end of file diff --git a/api/application/helpers/faceapi_helper.php b/api/application/helpers/faceapi_helper.php new file mode 100644 index 00000000..eb8cd8b0 --- /dev/null +++ b/api/application/helpers/faceapi_helper.php @@ -0,0 +1,106 @@ + \ No newline at end of file diff --git a/api/application/helpers/smc_creditpd_helper.php b/api/application/helpers/smc_creditpd_helper.php index 27b38faf..b406f971 100644 --- a/api/application/helpers/smc_creditpd_helper.php +++ b/api/application/helpers/smc_creditpd_helper.php @@ -34,6 +34,7 @@ class smc_creditpd break; case 8://assest $return_data = SELF::getAssestSectionData($section); + // print_r($return_data); break; case 11://supplier @@ -185,7 +186,9 @@ class smc_creditpd $seven_row = ''.' Is there a Loan Against the Asset? (Yes / No) '; foreach ($json['business_assets_details'] as $key => $value) { - + $json['business_assets_details'][$key]['business_assets_mode_name'] = ( $value['business_assets_mode'] == 1 ? $value['other_asset_description'] : $asset_type [ $value['business_assets_mode'] ]); + $json['business_assets_details'][$key]['business_owner_name'] = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); + $description = $value['other_asset_description']; if(isset($value['property_type'])) { @@ -381,6 +384,7 @@ class smc_creditpd $eight_row = ''.' Balance Tenure (Mnts) '; foreach ($json['existing_loan_details'] as $key => $value) { + $json['existing_loan_details'][$key]['business_owner_name'] = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); $header_row .= 'Loan '.($key + 1).''; $first_row .= ''. $value['loan_type'] .'';