FIX_BATCH_FILE_ENTRY

This commit is contained in:
VENKATESHWARAN 2025-11-07 12:01:10 +05:30
parent 436499e21a
commit 4302625f23
3 changed files with 19 additions and 11 deletions

View File

@ -12,6 +12,7 @@ use App\Controllers\BaseController;
use App\Controllers\VidalApiController;
use App\Controllers\ICICILombardController;
use App\Controllers\MediAssistApiController;
use App\Models\BatchFileModel;
use App\Models\FileModel;
class ApiServiceController extends BaseController
@ -145,8 +146,8 @@ class ApiServiceController extends BaseController
$branch_id = $this->request->getPost('client_branch_id') ?? null;
$policy_id = $this->request->getPost('client_policy_id') ?? null;
$fileModel = new FileModel();
$filesData = $fileModel->where('is_active', 1)->where('action', 'api')->where('status', 'inprogress')->countAllResults();
$fileModel = new BatchFileModel();
$filesData = $fileModel->where('is_active', 1)->where('event_type', 'api')->where('status', 'inprogress')->countAllResults();
if($filesData > 0){
log_message('error', "TPA GetBenefDetails job is already in process.");
@ -160,10 +161,13 @@ class ApiServiceController extends BaseController
$data = [
'file_name' => "API",
'action' => "api",
'event_type' => "api",
'actions' => "fetch",
'insurer_or_tpa' => "tpa",
'batch_code' => generate_random_string(4),
'status' => "inprogress",
'client_id' => $client_id,
'policy_id' => $policy_id,
'client_policy_id'=> $policy_id,
'client_branch_id'=> $branch_id,
'created_by'=> get_session_userid(),
];

View File

@ -3,7 +3,7 @@
namespace App\Controllers;
use App\Controllers\BaseController;
use App\Models\FileModel;
use App\Models\BatchFileModel;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\IncomingRequest;
use CodeIgniter\HTTP\RequestInterface;
@ -253,8 +253,8 @@ class MediAssistApiController extends BaseController
// update file table status after the tpa id failed to update
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new FileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
log_message('error', "Failed to update file table status.");
@ -325,7 +325,7 @@ class MediAssistApiController extends BaseController
// update file table status after the tpa id successfully updated
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new FileModel();
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'success')->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
@ -355,8 +355,8 @@ class MediAssistApiController extends BaseController
// update file table status after the tpa id failed to update
if (isset($requestData['file_id']) && !empty($requestData['file_id'])) {
$file_model = new FileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed')->update();
$file_model = new BatchFileModel();
$file_model->where('id', $requestData['file_id'])->set('status', 'failed-8')->update();
log_message('error', "Files table status updated for the file id : {$requestData['file_id']}");
} else {
log_message('error', "Failed to update file table status.");

View File

@ -63,7 +63,7 @@
<td><?php echo isset($file['policy_type']) ? $file['policy_type'] : '' ?> - <?php echo isset($file['policy_no']) ? $file['policy_no'] : '' ?></td>
<td><?php echo $file['event_type'] ?></td>
<td><?php echo $insurer_or_tpa[$file['insurer_or_tpa']] ?></td>
<td><?php echo $import_or_export[$file['actions']] ?></td>
<td><?php echo $import_or_export[$file['actions']] ?? ucfirst($file['actions']) ?></td>
<td><?php echo $file['count'] == null ? '-' : $file['count'] ?></td>
<td><?php echo format_indian_number($file['amount'])?></td>
@ -140,6 +140,10 @@
failed <a class="fe-alert-circle" style="color: #000;" data-toggle="tooltip"
data-placement="top" title="<?= $file['error_data'] ?>"></a>
<?php } else if ($file['status'] == 'failed-8') { ?>
failed
<?php } else { ?>
<?php echo $file['status']; ?>