Merge branch 'master' of https://bitbucket.org/venbaittech/sparqapi
This commit is contained in:
commit
2168ee606b
@ -99,7 +99,7 @@ defined('SAVEROOMINFO_API') OR define('SAVEROOMINFO_API', 'saveRoomInfo')
|
||||
defined('SAVESMCCREDITPDIMAGE_API') OR define('SAVESMCCREDITPDIMAGE_API', 'saveSMCCreditPDImage'); // no errors
|
||||
defined('GETSMCPDIMGSECTIONDATA_API') OR define('GETSMCPDIMGSECTIONDATA_API', 'getSMCPDImgSectionData'); // no errors
|
||||
//defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors
|
||||
|
||||
defined('CAMUNDA_URL') OR define('CAMUNDA_URL','http://34.121.71.79:8080/engine-rest/');
|
||||
/*********************AWS resources Constants*************************************************/
|
||||
defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic');
|
||||
if(ENVIRONMENT == 'development')
|
||||
|
||||
@ -302,6 +302,7 @@ $route['filterSalesPDList']='Sales_PD_Controller/filterSalesPDList';
|
||||
$route['generateSatelliteImg']='Sales_PD_Controller/generateSatelliteImg';
|
||||
$route['getSalesPDImgDataCusLink']='Sales_PD_Controller/getSalesPDImgDataCusLink';
|
||||
$route['sendSalesCusLinkViaSMS']='Sales_PD_Controller/sendSalesCusLinkViaSMS';
|
||||
$route['camundaTest']='Sales_PD_Controller/camundaTest';
|
||||
|
||||
|
||||
$route['listSMCCreditPD/(:num)']='SMC_Credit_PD_Controller/listSMCCreditPD';
|
||||
|
||||
@ -1023,7 +1023,7 @@ class PD_Controller extends REST_Controller {
|
||||
$pd_details['is_cus_link_disabled'] = 1;
|
||||
}
|
||||
|
||||
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED || $pd_details['pd_status'] == ALLOCATED))
|
||||
if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == TRIGGERED || $pd_details['pd_status'] == INITIATED || $pd_details['pd_status'] == INPROGRESS))
|
||||
{
|
||||
|
||||
/***********************CHOOSE PD TEMPALATE*********************/
|
||||
@ -11029,15 +11029,28 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
if(!empty($_FILES['video_file']))
|
||||
{
|
||||
$folder_to_check = XLPATH.'/pd_reports/'.$records['fk_pd_id'].'/videos';
|
||||
|
||||
if(!file_exists($folder_to_check))
|
||||
{
|
||||
mkdir($folder_to_check,0777);
|
||||
}
|
||||
// die();
|
||||
// $modified_fname = $records['rand_key'].'~'.str_replace(' ','_',($_FILES['pd_excel_data']['name']));
|
||||
$modified_fname = str_replace(' ','_',($_FILES['video_file']['name']));
|
||||
// echo file_exists($folder_to_check);die();
|
||||
|
||||
$config = array('upload_path' => $folder_to_check,'overwrite' => TRUE,'allowed_types' => '*','file_name' => $modified_fname);
|
||||
|
||||
$this->load->library('upload', $config);
|
||||
$this->upload->initialize($config);
|
||||
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if($this->upload->do_upload('video_file'))
|
||||
{
|
||||
|
||||
log_message('ERROR','video uplaod done :' . $folder_to_check);
|
||||
$sourcefile = $folder_to_check.'/'.$modified_fname;
|
||||
// echo $sourcefile;
|
||||
$key = 'pd'.$records['fk_pd_id'].'/video/'.$modified_fname;
|
||||
@ -11053,6 +11066,14 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
unlink($sourcefile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR','video uplaod failed :' . $folder_to_check);
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
log_message('ERROR','video uplaod failed exception:' . $folder_to_check.' - '.$e->getMessage());
|
||||
}
|
||||
// die();
|
||||
|
||||
if($is_bucket_upload_sucess && $id)
|
||||
|
||||
@ -9,6 +9,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
include_once APPPATH.'/vendor/autoload.php';
|
||||
|
||||
|
||||
class Sales_PD_Controller extends REST_Controller {
|
||||
@ -22,6 +23,7 @@ class Sales_PD_Controller extends REST_Controller {
|
||||
$this->load->library('AWS_S3');
|
||||
$this->load->library('pdfgenerator');
|
||||
$this->load->helper('satellite_image');
|
||||
$this->load->helper('camunda');
|
||||
$this->load->library('phpmailer_library');
|
||||
|
||||
|
||||
@ -549,6 +551,9 @@ class Sales_PD_Controller extends REST_Controller {
|
||||
$records['sales_pd_sno'] = $salepd_serial_no;
|
||||
// print_r($records);die();
|
||||
$id = $this->Sales_PD_Model->saveRecords($records,SALES_PD_DATA);
|
||||
|
||||
//start camunda process
|
||||
CAMUNDA::startSalesPDInstance($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -659,6 +664,8 @@ class Sales_PD_Controller extends REST_Controller {
|
||||
//echo 'final';die();
|
||||
$id = $this->Sales_PD_Model->updateRecords($records,SALES_PD_DATA,array('sales_pd_id' => $records['sales_pd_id']));
|
||||
|
||||
CAMUNDA::completeSalesPDTask($id);
|
||||
|
||||
$this->prepareSalesPDReport($records['sales_pd_id'],false);
|
||||
sleep(10);
|
||||
log_message('ERROR','####SALESPD AFTER 10 PREPARED REPORT'.$records['sales_pd_id']);
|
||||
@ -1191,6 +1198,15 @@ public function filterSalesPDList_post() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function camundaTest_post()
|
||||
{
|
||||
// echo 'hi';
|
||||
|
||||
CAMUNDA::completeSalesPDTask(1);
|
||||
//CAMUNDA::startSalesPDInstance(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -492,28 +492,29 @@ class User_Management_Controller extends REST_Controller {
|
||||
}
|
||||
// print_r($rcm_state_mapping);
|
||||
// die();
|
||||
if(!empty($rcm_state_mapping)) {
|
||||
$insert_value = array();
|
||||
foreach($rcm_state_mapping as $key=>$value) {
|
||||
if($value) {
|
||||
array_push($insert_value,(object)[
|
||||
"fk_user_id" => $user_id,
|
||||
"fk_state_id" => $value,
|
||||
"isactive" => "1"
|
||||
]);
|
||||
}
|
||||
}
|
||||
if(!empty($insert_value)) {
|
||||
$res = $this->db->insert_batch(RCM_STATE_MAPPING,$insert_value);
|
||||
$rcmstate_msg = "RCM States Added";
|
||||
}
|
||||
}
|
||||
|
||||
// echo "\n old data \n";
|
||||
// print_r($user_config['rcm_state_mapping']);
|
||||
// echo "new data";
|
||||
// print_r($rcm_state_mapping);
|
||||
// die();
|
||||
}
|
||||
if(!empty($rcm_state_mapping)) {
|
||||
$insert_value = array();
|
||||
foreach($rcm_state_mapping as $key=>$value) {
|
||||
if($value) {
|
||||
array_push($insert_value,(object)[
|
||||
"fk_user_id" => $user_id,
|
||||
"fk_state_id" => $value,
|
||||
"isactive" => "1"
|
||||
]);
|
||||
}
|
||||
}
|
||||
if(!empty($insert_value)) {
|
||||
$res = $this->db->insert_batch(RCM_STATE_MAPPING,$insert_value);
|
||||
$rcmstate_msg = "RCM States Added";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** END OF INSERTING THE RCM STATE MAPPING DATA */
|
||||
|
||||
154
api/application/helpers/camunda_helper.php
Normal file
154
api/application/helpers/camunda_helper.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
class CAMUNDA
|
||||
{
|
||||
|
||||
//include_once APPPATH.'/vendor/autoload.php';
|
||||
|
||||
//create a new instance
|
||||
public static function startNewInstance($process_def_id,$data = array())
|
||||
{
|
||||
$url = CAMUNDA_URL.'process-definition/'.$process_def_id.'/start';
|
||||
$client = new \GuzzleHttp\Client();
|
||||
try {
|
||||
|
||||
$response = $client->post( $url, [
|
||||
'headers' => ['Content-Type' => 'application/json']
|
||||
//'body' => json_encode($data)
|
||||
]);
|
||||
|
||||
if($response && $response->getStatusCode() == 200)
|
||||
{
|
||||
return (json_decode(($response->getBody()->getContents())));
|
||||
// echo $response->getBody()->getContents()->id;
|
||||
// echo $response->getBody()->getContents()['id'];
|
||||
// die();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
//return null;
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// complete an activity in an instance or instance
|
||||
public static function completeInstance($instanceID,$data = array())
|
||||
{
|
||||
$url = CAMUNDA_URL.'task/'.$instanceID.'/complete';
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->post( $url, [
|
||||
'headers' => ['Content-Type' => 'application/json']
|
||||
//'body' => json_encode($data)
|
||||
]);
|
||||
|
||||
if($response && $response->getStatusCode() == 200)
|
||||
{
|
||||
return json_encode($response->getBody()->getContents());
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function getListOfInstanceByProcessDefinitionKey($processDefinitionKey,$data = array())
|
||||
{
|
||||
$url = CAMUNDA_URL . 'task?processDefinitionKey='.$processDefinitionKey;
|
||||
// echo $url;//die();
|
||||
|
||||
$client = new \GuzzleHttp\Client();
|
||||
$response = $client->request('GET',$url);
|
||||
|
||||
// $client = new \GuzzleHttp\Client();
|
||||
// $res = $client->get( $url, [
|
||||
// 'headers' => ['Content-Type' => 'application/json'],
|
||||
// 'body' => json_encode($data)
|
||||
// ]);
|
||||
if($response && $response->getStatusCode() == 200)
|
||||
{
|
||||
return json_decode($response->getBody()->getContents());
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// print_r();
|
||||
// print_r($response->getStatusCode());
|
||||
}
|
||||
|
||||
|
||||
public static function startSalesPDInstance($sales_pd_id)
|
||||
{
|
||||
|
||||
$CI =& get_instance();
|
||||
if($sales_pd_id)
|
||||
{
|
||||
$newProcessInstanceID = SELF::startNewInstance('sales_pd_demo:1:38949d25-8c83-11eb-a4f2-42010a800002');
|
||||
if($newProcessInstanceID && property_exists($newProcessInstanceID, 'id'))
|
||||
{
|
||||
$updated = $CI->Sales_PD_Model->updateRecords(array('t_process_instance_id' => $newProcessInstanceID->id),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));
|
||||
log_message('ERROR','####Camunda start new instance success - ', $sales_pd_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR','####Camunda start new instance failed - ', $sales_pd_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static function completeSalesPDTask($sales_pd_id)//completeSalesPDTask ot instance
|
||||
{
|
||||
|
||||
$CI =& get_instance();
|
||||
if($sales_pd_id)
|
||||
{
|
||||
$fields=array('t_process_instance_id');
|
||||
$sales_pd_data = $CI->Sales_PD_Model->selectCustomRecords($fields,array('sales_pd_id' => $sales_pd_id),SALES_PD_DATA);
|
||||
|
||||
if($sales_pd_data && count($sales_pd_data))
|
||||
{
|
||||
//get list of task
|
||||
$task_id = null;
|
||||
$list_of_task = SELF::getListOfInstanceByProcessDefinitionKey('sales_pd_demo');
|
||||
if($list_of_task && count($list_of_task))
|
||||
{
|
||||
foreach ($list_of_task as $task_key => $task)
|
||||
{
|
||||
if($sales_pd_data[0]['t_process_instance_id'] == $task->processInstanceId)
|
||||
{
|
||||
$task_id = $task->id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR','####Couldn`t identify Camunda instance - ', $sales_pd_id);
|
||||
}
|
||||
|
||||
|
||||
if($task_id)
|
||||
{
|
||||
SELF::completeInstance($task_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR','####Couldn`t identify task id - ', $sales_pd_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log_message('ERROR','#### could not get sales pd data - ', $sales_pd_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@ -26,11 +26,12 @@ class Dash_Board_Model extends SPARQ_Model {
|
||||
|
||||
public function getDetailsOfPDType($fdate,$tdate,$cityarr,$lenderarr)
|
||||
{
|
||||
$smc_lender_id = (ENVIRONMENT == 'production' ? 7 : 35)
|
||||
if(($lenderarr != "" || $lenderarr != null)&& ($cityarr != "" || $cityarr != null) && ($fdate && $tdate != '')){
|
||||
$sql_query = "SELECT if(fk_pd_type = 1,'FULL',if(fk_pd_type = 2,'SMART',if(fk_pd_type = 3,'TELE','NULL'))) as PDTYPE,pd_status,count(*) as count FROM t_pd_triggered where MONTH(createdon) = MONTH(CURDATE()) group by fk_pd_type,pd_status;";
|
||||
$sql_query = "SELECT if(fk_pd_type = 1,'FULL',if(fk_pd_type = 2,'SMART',if(fk_pd_type = 3,'TELE','NULL'))) as PDTYPE,pd_status,count(*) as count FROM t_pd_triggered where MONTH(createdon) = MONTH(CURDATE()) AND fk_lender_id != $smc_lender_id group by fk_pd_type,pd_status;";
|
||||
}
|
||||
else{
|
||||
$sql_query = "SELECT if(fk_pd_type = 1,'FULL',if(fk_pd_type = 2,'SMART',if(fk_pd_type = 3,'TELE','NULL'))) as PDTYPE,pd_status,count(*) as count FROM t_pd_triggered where ";
|
||||
$sql_query = "SELECT if(fk_pd_type = 1,'FULL',if(fk_pd_type = 2,'SMART',if(fk_pd_type = 3,'TELE','NULL'))) as PDTYPE,pd_status,count(*) as count FROM t_pd_triggered where fk_lender_id != $smc_lender_id AND";
|
||||
|
||||
if($lenderarr != "")
|
||||
{
|
||||
|
||||
@ -278,6 +278,10 @@ class PD_Model extends SPARQ_Model {
|
||||
{
|
||||
$this->db->WHERE_IN('PDTRIGGER.fk_lender_id',$pd_lender);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->WHERE('PDTRIGGER.fk_lender_id != ',(ENVIRONMENT == 'production' ? 7 : 35));
|
||||
}
|
||||
|
||||
if($pd_applicant_lender_ref != "" || $pd_applicant_lender_ref != null )
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user