COMPANY MAS
This commit is contained in:
parent
e164e8f36b
commit
e58eb5aa70
@ -85,8 +85,8 @@ defined('EXIT__AUTO_MIN') OR define('EXIT__AUTO_MIN', 9); // lowest automat
|
||||
defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
|
||||
|
||||
// define login route name for token verification
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfProducts'); // no errors
|
||||
defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listLessPDDetails/:any)'); // no errors
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'triggerNewPD'); // no errors
|
||||
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
|
||||
@ -73,6 +73,7 @@ $route['saveMaster'] = 'Common_Masters_Controller/saveMaster';
|
||||
$route['savePDAllocationType'] = 'Common_Masters_Controller/savePDAllocationType';
|
||||
$route['savePDNotifications'] = 'Common_Masters_Controller/savePDNotifications';
|
||||
$route['getPDNotificationsList'] = 'Common_Masters_Controller/getPDNotificationsList';
|
||||
$route['saveCompany'] = 'Common_Masters_Controller/saveCompany';
|
||||
|
||||
|
||||
|
||||
@ -82,6 +83,7 @@ $route['getListOfUsers'] = 'User_Management_Controller/listAllUsers';
|
||||
$route['saveNewUser'] = 'User_Management_Controller/saveNewUser';
|
||||
$route['updateExistUser'] = 'User_Management_Controller/updateExistUser';
|
||||
$route['getUsersDetails'] = 'User_Management_Controller/getUsersDetails';
|
||||
$route['getSingedProfilePicURL'] = 'User_Management_Controller/getSingedProfilePicURL';
|
||||
|
||||
// TEMPLATE MANAGEMENT
|
||||
$route['listAllTemplates'] = 'Template_Management_Controller/listAllTemplates';
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -170,12 +170,14 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
|
||||
/********For Save New PD while Trigger****/
|
||||
/*
|
||||
sample data
|
||||
{
|
||||
"pd_details":{ "fk_lender_id": "1", "lender_applicant_id":"12458","fk_product_id":"2","fk_subproduct_id":"1","fk_pd_type":"2", "fk_pd_status":"2","pd_specific_clarification":"nothing","createdon":"2017","fk_createdby":"2","fk_pd_allocation_type":"3","fk_pd_allocated_to":"1","fk_pd_template_id":"2","fk_customer_segment":"1","pd_officier_final_judgement":"54561","pd_agency_id":"1","loan_amount":"1589655","addressline1":"1", "addressline2":"2", "addressline3":"3", "fk_city":"1", "fk_state":"2", "pincode":"966852"}
|
||||
}
|
||||
*/
|
||||
public function triggerNewPD_post()
|
||||
{
|
||||
//echo "TRIGGER";
|
||||
//$this->aws_ses->verifyEmailIdentity('raro@spindl-e.com');
|
||||
//$this->aws_ses->sendMail('raro@spindl-e.com');
|
||||
//die();
|
||||
$pd_details = json_decode($this->post('pd_details'),true);
|
||||
$pd_applicant_details = json_decode($this->post('pd_applicant_details'),true);
|
||||
$pd_document_titles = json_decode($this->post('pd_document_titles'),true);
|
||||
@ -207,55 +209,60 @@ class PD_Controller extends REST_Controller {
|
||||
$temp_city_id = $this->PD_Model->selectRecords(PDTEAMMAP,$where_condition_array,$limit=0,$offset=0);
|
||||
if(count($temp_city_id))
|
||||
{
|
||||
if($temp_city_id[0]['type'] == 0) // Allocate to Vendor
|
||||
if(isset($temp_city_id[0]['type']))
|
||||
{
|
||||
$pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id'];
|
||||
$pd_details['fk_pd_allocated_to'] = ALLOCATED_TO_PARTNER;
|
||||
}
|
||||
else //Allocate to SineEdge Team with allocation logics
|
||||
{
|
||||
$local_pd_allocation_type = $pd_details['fk_pd_allocation_type'];
|
||||
if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation
|
||||
{
|
||||
|
||||
//select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
|
||||
$fields = array('fk_user_id,allocated');
|
||||
if($temp_city_id[0]['type'] == 0) // Allocate to Vendor
|
||||
{
|
||||
$pd_details['pd_agency_id'] = $temp_city_id[0]['fk_team_id'];
|
||||
$pd_details['fk_pd_allocated_to'] = ALLOCATED_TO_PARTNER;
|
||||
}
|
||||
else //Allocate to SineEdge Team with allocation logics
|
||||
{
|
||||
$local_pd_allocation_type = $pd_details['fk_pd_allocation_type'];
|
||||
if($local_pd_allocation_type == 1)// AUTO - Load Balance Allocation
|
||||
{
|
||||
|
||||
$where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1);
|
||||
//select list of pd officers based on pd type, product, customer segment, and team from table (t_pd_officiers_details) and choose minimun allocated one and assign pd Officer and change status form TRIGGERED to ALLOCATED
|
||||
$fields = array('fk_user_id,allocated');
|
||||
|
||||
$where_condition_array = array('fk_pd_type_id' => $pd_details['fk_pd_type'],'fk_team_id' => $temp_city_id[0]['fk_team_id'],'fk_customer_segment' => $pd_details['fk_customer_segment'],'fk_product_id' => $pd_details['fk_product_id'],'isactive' => 1);
|
||||
|
||||
$list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
|
||||
|
||||
$allocated_values = array_column($list_of_pd_officers,'allocated');
|
||||
|
||||
$min_allocated = min($allocated_values);
|
||||
$key = array_search($min_allocated,$allocated_values);
|
||||
$final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id'];
|
||||
|
||||
//For Random Allocaiton not in use
|
||||
// $key = mt_rand(0, count($list_of_pd_officers) - 1);
|
||||
// $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null;
|
||||
|
||||
$pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
|
||||
$pd_details['fk_pd_status'] = ALLOCATED;
|
||||
|
||||
$list_of_pd_officers = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDOFFICIERSDETAILS);
|
||||
|
||||
$allocated_values = array_column($list_of_pd_officers,'allocated');
|
||||
}
|
||||
else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation
|
||||
{
|
||||
|
||||
$min_allocated = min($allocated_values);
|
||||
$key = array_search($min_allocated,$allocated_values);
|
||||
$final_pd_officer_to_allocate = $list_of_pd_officers[$key]['fk_user_id'];
|
||||
|
||||
//For Random Allocaiton not in use
|
||||
// $key = mt_rand(0, count($list_of_pd_officers) - 1);
|
||||
// $final_pd_officer_to_allocate = isset($list_of_pd_officers[$key])? $list_of_pd_officers[$key]: null;
|
||||
|
||||
$pd_details['fk_pd_allocated_to'] = $final_pd_officer_to_allocate;
|
||||
$pd_details['fk_pd_status'] = ALLOCATED;
|
||||
|
||||
|
||||
}
|
||||
else if($local_pd_allocation_type == 2) // AUTO - NEAREST Allocation
|
||||
{
|
||||
|
||||
}
|
||||
else // Manual Allocation
|
||||
{
|
||||
// Do nothing, cause fk_pd_allocated_to value comes from front end.
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else // Manual Allocation
|
||||
{
|
||||
// Do nothing, cause fk_pd_allocated_to value comes from front end.
|
||||
}
|
||||
|
||||
}
|
||||
}//End Of isset
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***********************END OF PD ALLOCATION TYPE AND PROCESS***********/
|
||||
|
||||
|
||||
$pd_id = $this->PD_Model->saveRecords(PDTRIGGER,$pd_details);
|
||||
|
||||
|
||||
@ -300,7 +307,11 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update into pd officer details
|
||||
if($pd_details['fk_pd_allocated_to'] != null || $pd_details['fk_pd_allocated_to'] != '')
|
||||
{
|
||||
$this->PD_Model->updatePDofficersDetail($pd_details['fk_pd_allocated_to']);
|
||||
}
|
||||
if($pd_id != null || $pd_id != '' && $count != 0)
|
||||
{
|
||||
// CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus
|
||||
|
||||
@ -129,7 +129,7 @@ class User_Management_Controller extends REST_Controller {
|
||||
|
||||
if($pdofficer != ""){
|
||||
$pdofficer['fk_user_id'] = $user_id;
|
||||
print_r($pdofficer);
|
||||
//print_r($pdofficer);
|
||||
$this->User_Management_Model->saveRecords($pdofficer,PDOFFICIERSDETAILS);
|
||||
}
|
||||
if($user_id != '' || $user_id != null)
|
||||
@ -302,7 +302,7 @@ class User_Management_Controller extends REST_Controller {
|
||||
@params userid , entity id, profilepic name
|
||||
URL expires 5 min
|
||||
*/
|
||||
public function getSingedProfilePicURL()
|
||||
public function getSingedProfilePicURL_post()
|
||||
{
|
||||
$userid = $this->post('userid');
|
||||
$entityid = $this->post('entityid');
|
||||
|
||||
@ -13,7 +13,7 @@ class SPARQ_Model extends CI_Model {
|
||||
|
||||
}
|
||||
|
||||
public function saveRecords($record_data = array(),$table_name,$print_query = '')
|
||||
public function saveRecords($table_name,$record_data = array(),$print_query = '')
|
||||
{
|
||||
|
||||
$this->db->insert($table_name,$record_data);
|
||||
|
||||
@ -22,27 +22,28 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','PDTRIGGER.fk_createdby = USERPROFILE.userid');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','PDTRIGGER.fk_updatedby = USERPROFILE1.userid','LEFT');
|
||||
$this->db->JOIN(PDALLOCATIONTYPE.' as PDALLOCATIONTYPE','PDTRIGGER.fk_pd_allocation_type = PDALLOCATIONTYPE.pd_allocation_type_id');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocation_type = USERPROFILE2.userid');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE2','PDTRIGGER.fk_pd_allocated_to = USERPROFILE2.userid');
|
||||
$this->db->JOIN(TEMPLATE.' as TEMPLATE','PDTRIGGER.fk_pd_template_id = TEMPLATE.template_id');
|
||||
$this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','PDTRIGGER.fk_customer_segment = CUSTOMERSEGMENT.customer_segment_id');
|
||||
$this->db->JOIN(ENTITY.' as AGENCY','PDTRIGGER.pd_agency_id = AGENCY.entity_id','LEFT');
|
||||
$this->db->ORDER_BY('PDTRIGGER.pd_id',$sort);
|
||||
$this->db->LIMIT($page,$limit);
|
||||
$this->db->LIMIT($limit,$page);
|
||||
$result_array = $this->db->GET()->result_array();
|
||||
|
||||
if(count($result_array) != 0)
|
||||
{
|
||||
foreach($result_array as $key => $result)
|
||||
{
|
||||
|
||||
$this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode');
|
||||
$this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS');
|
||||
$this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id ');
|
||||
$this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id');
|
||||
$this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id = $result["pd_id"]');
|
||||
$this->db->WHERE('PDAPPLICANTSDETAILS.fk_pd_id ',$result['pd_id']);
|
||||
$result_child_array = $this->db->GET()->result_array();
|
||||
if(count($result_child_array) != 0)
|
||||
{
|
||||
array_push($result[$key],$result_child_array);
|
||||
$result_array[$key]['applicat_details'] = $result_child_array;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -72,4 +73,10 @@ class PD_Model extends SPARQ_Model {
|
||||
$this->db->WHERE_IN('fk_user_id',$lender_specific_pdofficers_list);
|
||||
$result = $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function updatePDofficersDetail($userid)
|
||||
{
|
||||
$sql = 'UPDATE '.PDOFFICIERSDETAILS.' SET total = total+1, allocated = allocated+1 WHERE fk_user_id ='.$userid;
|
||||
$modified = $this->db->query($sql);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user