From 7f8e9022f3bdb863922c3eacbcd7b1fecadc3441 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Fri, 24 Jan 2020 15:04:15 +0530 Subject: [PATCH] SATELLITE IMG API OT ASSEST FIN NAME --- api/application/config/routes.php | 1 + .../Entity_Management_Controller.php | 15 ++++++- api/application/controllers/PD_Controller.php | 42 ++++++++++++++++++- api/application/helpers/assetsform_helper.php | 6 +-- .../helpers/satellite_image_helper.php | 10 ++++- 5 files changed, 66 insertions(+), 8 deletions(-) diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 46a4f010..d1981d70 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -241,6 +241,7 @@ $route['getPDImages'] = 'PD_Controller/getPDImages'; $route['deactiveFormData'] = 'PD_Controller/deactiveFormData'; $route['getNextRentalCount'] = 'PD_Controller/getNextRentalCount'; $route['photoPDFDownload'] = 'PD_Controller/imgPDFDownload'; +$route['renewSatellite'] = 'PD_Controller/renewSatellite'; //$route['getTypeOfActivetyFromBusinessJSON'] = 'PD_Controller/getTypeOfActivetyFromBusinessJSON'; //Dashboard and Reports Related routes diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index 9e190c97..0b8afbd8 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -983,7 +983,7 @@ class Entity_Management_Controller extends REST_Controller { } $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = array('products' => $products,'customer_segments' => $customer_segments,'pd_types' => $pd_types,'fk_createdby' => $fk_createdby,'default_product' => $default_product,'default_customer_segment' => $default_customer_segment,'default_pd_type' => $default_pd_type); + $data['records'] = array('products' => $products,'customer_segments' => $customer_segments,'pd_types' => $pd_types,'fk_createdby' => $fk_createdby,'products_default' => $default_product,'customer_segments_default' => $default_customer_segment,'pd_types_default' => $default_pd_type); $this->response($data,REST_Controller::HTTP_OK); } @@ -1116,6 +1116,10 @@ class Entity_Management_Controller extends REST_Controller { $customer_segments = array(); $pd_types = array(); $financial_institutions = array(); + $default_product = null; + $default_pd_type = null; + $default_customer_segment = null; + $default_sub_product = null; //echo $entity_id; $existing_preferences = $this->Entity_Management_Model->selectCustomRecords(array('*'),array('fk_entity_id' => $entity_id),ENTITYPREFERENCE); @@ -1135,19 +1139,26 @@ class Entity_Management_Controller extends REST_Controller { { $products = explode(",",$preference_value['values']); //$products = '(' . $preference_value['values'] . ')'; + $default_product = $preference_value['default_value']; } if($preference_value['preference_type'] == 2) { $customer_segments = explode(",",$preference_value['values']); + $default_customer_segment = $preference_value['default_value']; } if($preference_value['preference_type'] == 3) { $pd_types = explode(",",$preference_value['values']); + $default_pd_type = $preference_value['default_value']; } if($preference_value['preference_type'] == 4) { $salespd_products = explode(",",$preference_value['values']); } + if($preference_value['preference_type'] == 5) + { + $default_sub_product = $preference_value['values']; + } } @@ -1209,7 +1220,7 @@ class Entity_Management_Controller extends REST_Controller { $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = array('products' =>$products,'customer_segments' => $customer_segments, 'pd_types' => $pd_types,'financial_institutions' => $financial_institutions,'salespd_products' => $salespd_products); + $data['records'] = array('products' =>$products,'customer_segments' => $customer_segments, 'pd_types' => $pd_types,'financial_institutions' => $financial_institutions,'salespd_products' => $salespd_products,'default_product' =>$default_product,'default_customer_segment' => $default_customer_segment,'default_pd_type' => $default_pd_type,'default_sub_product' => $default_sub_product); $this->response($data,REST_Controller::HTTP_OK); diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 75faea7a..4ab7665b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -5855,7 +5855,7 @@ public function getPDFormDetailsJSON_post() public function codeigniterViewTest_post() { //print_r($this->aws_s3->createNewBucket('len3'));die(); - //satellite_image::getSatelliteImage(997);die(); + //satellite_image::getSatelliteImage(1213);die(); //echo $this->assignPDTempalate(1325);die(); //$this->getSatelliteImage(342);die();//velmurugan.s@venbainfotech.com // PDALERTS::sendSalesPDMail($this,2);die(); @@ -6118,7 +6118,7 @@ public function getPDFormDetailsJSON_post() //$t = $this->load->view('temp_html.html',null,true); echo $t; - //die(); + die(); $total_replaces = substr_count($t,''); for($i = 0 ;$i < $total_replaces;$i++) @@ -9421,6 +9421,44 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() $this->response($data,REST_Controller::HTTP_OK); } } + + public function renewSatellite_post() + { + $records = $this->post('records'); + + $id = $this->PD_Model->updateRecords(array('start_location' => $records['geo_location'],'fk_updatedby' => $records['fk_updatedby']),PDTRIGGER,array('pd_id' => $records['pd_id'])); + + if($id) + { + $is_gen = satellite_image::getSatelliteImage($records['pd_id'],1,true); + + if($is_gen) + { + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $id; + $this->response($data,REST_Controller::HTTP_OK); + } + else + { + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Something went wrong..! Try Later...!'; + $this->response($data,REST_Controller::HTTP_OK); + } + + } + else + { + + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + $data['msg'] = 'Something went wrong..! Try Later...!'; + $this->response($data,REST_Controller::HTTP_OK); + } + + + } } diff --git a/api/application/helpers/assetsform_helper.php b/api/application/helpers/assetsform_helper.php index d666ec18..ae558168 100644 --- a/api/application/helpers/assetsform_helper.php +++ b/api/application/helpers/assetsform_helper.php @@ -50,13 +50,13 @@ public static function getOthersAssetsDetails($values,$pdid){ $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name']; break; case 4: - $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name']; + $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; break; case 5: - $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name']; + $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; break; case 6: - $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name']; + $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['in_which_organisation']; break; default: $storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type_master'].' with '.$fetchVal['details'][0]['bank_name']; diff --git a/api/application/helpers/satellite_image_helper.php b/api/application/helpers/satellite_image_helper.php index 8610a315..c6506198 100644 --- a/api/application/helpers/satellite_image_helper.php +++ b/api/application/helpers/satellite_image_helper.php @@ -3,9 +3,11 @@ class satellite_image { - public static function getSatelliteImage($pd_id,$pd_type = 1)//1 - credit PD,2 - sales pd + public static function getSatelliteImage($pd_id,$pd_type = 1,$api = null)//1 - credit PD,2 - sales pd { $pdid = $pd_id; + + $api_return = null; $CI =&get_instance(); $path_to_check = $pd_type == 1 ? $CI->external_path.'/pd_reports/'.$pdid : $CI->external_path.'/sales_pd/'.$pdid; @@ -81,6 +83,7 @@ class satellite_image $CI->PD_Model->updateRecords(array('isactive' => 0),PDDOCUMENTS,array('pd_document_title' => 'satellite','fk_pd_id' => $pd_id)); $record_data = array('fk_pd_id' => $pdid,'pd_document_title'=>'satellite','pd_document_name'=>'satellite.png','fk_form_id'=>null,'rental_count_id' => null,'location' => null); $id = $CI->PD_Model->saveRecords($record_data,PDDOCUMENTS); + $api_return = $id; $custom_log_info = '###CUSTOM DEBUG SATELLITE IMAGE STORED IN S3 DONE - '. $id; log_message('ERROR',$custom_log_info); @@ -98,6 +101,11 @@ class satellite_image //generate log $logger->info("Generate Satellite Called in (".ENVIRONMENT.")",array('script' => $satellite_script,'script_output' => $ou)); //return $base64_pdscore_chart_url; + + if($api) + { + return $api_return; + } } }