Диплом: Автоматизация и обеспечение информационной безопасности обработки заявок в ПАО "СКБ Банк"

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам
107
Рис. п1.6 Форма заполнения заявки. Шаг 6
108
Подсказки экранов формы ввода анкетных данных.
Рис. п1.7 Форма заполнения заявки с подсказками. Шаг 1
Рис. п1.8 Форма заполнения заявки с подсказкой. Шаг 2
109
Приложение 3.
Листинг программных модулей
Исходный текст модуля интерфейса API
<?php
namespace app\modules\api2\controllers;
class ApiController extends ActiveController
{
public $modelClass = 'app\modules\landings\models\Claims';
public function actionPostClaim(): array
{
$response = [];
if (!empty($post = Yii::$app->request->post())) {
$post = $this->imitateFormPost();
if ($this->formManager->object->load($post)) {
if ($this->formManager->object->validate()) {
if ($this->formManager->object->validateOnly()) {
$response = ['validated' => 1];
} else {
if ($this->formManager->object->save(false)) {
if ($this->formManager->object->isUnhandledDuplicate()) {
$this->errorManager->setError(ErrorManager::STATE_API_CLAIM_IS_DUPLICATE);
}
//$response = $this->formManager->getApiResponse();
$response = $this->formManager->object->getApiResponse();
$this->getLdgPixelParams($this->formManager->object->id);
} else {
$this->errorManager->setError(ErrorManager::STATE_API_CLAIM_NOT_SAVED);
}
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_VALIDATION_ERROR, $this-
>formManager->object->getErrors());
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_FORM_WAS_NOT_LOADED);
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_EMPTY_POST);
}
return $this->getAnswer($response);
}
public function actionPostFile(): array
{
$response['errors'] = 'empty';
if (Yii::$app->request->isPost) {
if (isset(Yii::$app->request->bodyParams['hash']) &&
isset(Yii::$app->request->bodyParams['file_name']) &&
110
isset(Yii::$app->request->bodyParams['file_extension']) &&
isset(Yii::$app->request->bodyParams['file_content'])
) {
$hash = Yii::$app->request->bodyParams['hash'];
$filename = Yii::$app->request->bodyParams['file_name'];
$fileextension = Yii::$app->request->bodyParams['file_extension'];
$content = Yii::$app->request->bodyParams['file_content'];
/** @var RabbitTransporter $rabbit */
$rabbit = Yii::$app->creditFrontTransporter;
$rabbit->setPassage(CreditSiebel::TRANSPORTER_PASSAGE_FILE_CASH_RQ);
$response['transfered'] = $rabbit->pushFile($hash, $filename, $fileextension, $content);
}
}
return $this->getAnswer($response);
}
public function actionGetClaim($h): array
{
$hash = $h;
$response = [];
$claim = Yii::$app->db->useMaster(function ($db) use ($hash) {
return Claims::find()
->with('info')
->with('states')
->where(['hash' => $hash])
->one();
});
if ($claim) {
// todo need to filter this values, we don't need it all on front
$this->formManager->object->setAttributes(array_merge($claim->attributes, $claim->info-
>attributes, $claim->info->dataArray), false);
$response['last_scenario'] = ArrayHelper::getValue($claim, 'info.dataArray.lastScenario');
$response['hash'] = $claim->hash;
$importantFields = [
'sex',
'office',
'first_name',
'middle_name',
'birth_date',
'income_proof',
'city_code',
'spouse_state',
'passport_has_changed',
'passport_issued_when',
'registration_address_equal_to_factual_address',
'international_passport_availability',
'employment_state',
111
'consent_to_life_insurance',
'consent_to_insurance_against_job_loss',
'post_not_found',
];
foreach (get_object_vars($this->formManager->object) as $attribute => $attributeValue) {
if (in_array($attribute, ['lastScenario', 'validateOnly'])) {
continue;
}
if (in_array($attribute, $importantFields) && $attributeValue != '') {
$response['attributes'][$attribute] = $attributeValue;
} else {
$response['attributes'][$attribute] = $attributeValue !== null && $attributeValue !== '';
}
if($attribute == 'city_name')
if(!empty($response['attributes'][$attribute]))
if ($response['attributes'][$attribute] == 'Город не найден')
$response['attributes'][$attribute] = false;
}
} else {
$this->errorManager->setError(ErrorManager::STATE_API_INCORRECT_HASH);
}
return $this->getAnswer($response);
}
public function actionGetList($list, $query = null): array
{
if (empty($this->formManager) || is_null($this->formManager->getList($list, $query))) {
$this->errorManager->setError(ErrorManager::STATE_API_UNDEFINED_LIST);
}
return $this->getAnswer(['list' => $this->formManager->getList($list, $query)]);
}
/**
* Get all available lists for current form
*
* @return array
*/
public function actionGetLists()//: array
{
return $this->getAnswer(['available_lists' => $this->formManager->getLists()]);
}
public function actionSendCode($claim_hash): array
{
if (!Hash::getInstance($claim_hash)->isHash()) {
$this->errorManager->setError(ErrorManager::STATE_API_INCORRECT_HASH);
}
$response = [];
$smsManager = new SmsManager();
$smsManager->setClaim($claim_hash);
112
$smsManager->setSource($this->formManager->getBank());
if ($smsManager->requestNewCode()) {
$response = ['sent' => 1];
} else {
$this->errorManager->setError(ErrorManager::STATE_API_SMS_NOT_SENT);
}
return $this->getAnswer($response);
}
}
Исходный текст модуля «Отправка заявки в банковские системы»
<?php
namespace app\modules\landings\components\rabbit;
class CreditSiebel extends RabbitTransporter
{
public function init()
{
parent::init();
$this->on(self::EVENT_CLAIM_COMMUNICATION_PRELIMINARY_DECISION, function ($event) {
$claim = Yii::$app->db->useMaster(function ($db) use ($event) {
return Claims::find()
->with('info')
->byId($event->claim->id);
});
if ($this->isLastStep($event->claim->id) && $this->isOfferedClaim($event->claim->id)) {
/** @var CreditFrontCommunicate $communication */
$communication = new CreditFrontCommunicate();
$communication->actionPreliminaryDecision($claim);
}
});
$this->on(self::EVENT_CLAIM_COMMUNICATION_READY_TO_ISSUE, function ($event) {
$claim = Yii::$app->db->useMaster(function ($db) use ($event) {
return Claims::find()
->with('info')
->byId($event->claim->id);
});
if ($this->isLastStep($event->claim->id) && $this->isOfferedClaim($event->claim->id)) {
/** @var CreditFrontCommunicate $communication */
$communication = new CreditFrontCommunicate();
$communication->actionReadyToIssue($claim);
}
});
113
$this->on(self::EVENT_CLAIM_COMMUNICATION_FAILURE, function ($event) {
if ($this->isLastStep($event->claim->id) && $this->isDeclinedClaim($event->claim->id)) {
/** @var CreditFrontCommunicate $communication */
$communication = new CreditFrontCommunicate();
$communication->actionFailure($event->claim);
}
});
}
private function isOfferedClaim($claimId)
{
$offered = false;
$claimState = ClaimsState::find()->byClaimId($claimId);
if ($claimState->is_offered == ClaimsState::CLAIM_IS_OFFERED) $offered = true;
return $offered;
}
private function isDeclinedClaim($claimId)
{
$declined = false;
$claimState = ClaimsState::find()->byClaimId($claimId);
if ($claimState->is_declined == ClaimsState::CLAIM_IS_DECLINED) $declined = true;
return $declined;
}
/**
* checks for last step of claim for communication start
*
* @param $claimId
* @return bool
*/
private function isLastStep($claimId)
{
$lastStep = false;
$rabbit = RabbitQueue::find()
->outgoing()
->byClaimId($claimId)
->byAddType(self::REQUEST_TYPE_UPDATE)
->byType(RabbitQueue::TYPE_CREDIT_FRONT)
->limit(1)
->addOrderBy(['id' => SORT_DESC])
->one();
if (count($rabbit) > 0) {
$_message = $rabbit->message;
$message = Json::decode($_message);
114
$step = ArrayHelper::getValue($message, 'WS.BODY.CLAIM_STEP');
if ($step === 6) {
$lastStep = true;
}
}
return $lastStep;
}
/**
* Pushing new message into rabbit queue
*
* @return bool
* @throws ErrorException
*/
public function push(): bool
{
if (!$this->getRequestForPassage()) {
return false;
}
if (!isset($this->claim)) {
$this->setClaim($this->claim);
}
if (!$this->getRqUid()) {
$this->setRqUid();
}
$message = $this->getOuterMessage();
$claimId = $this->claim->id;
$addType = $this->getAddType();
$rabbitQueue = new RabbitQueue(RabbitQueue::STATUS_NEW);
$rabbitQueue->type = RabbitQueue::TYPE_CREDIT_FRONT;
$rabbitQueue->message = $message;
$rabbitQueue->claim_id = $claimId;
$rabbitQueue->rq_uid = $this->getRqUid();
$rabbitQueue->direction = RabbitQueue::DIRECTION_OUT;
$rabbitQueue->add_type = $addType;
if ($rabbitQueue->save(false)) {
$this->runTheWolf();
if ($addType == self::REQUEST_TYPE_UPDATE) {
if (ArrayHelper::getValue($this->claim->info->dataArray, 'step') == 6 && $this-
>isOfferedClaim($claimId)) {
$event = new ClaimCommunicationEvent();
115
$event->claim = $this->claim;
/** ----==== EVENT_CLAIM_COMMUNICATION_READY_TO_ISSUE ====---- */
$this->trigger(self::EVENT_CLAIM_COMMUNICATION_PRELIMINARY_DECISION, $event);
//} elseif ($this->claim->info->dataArray['step'] == 6 && $this->isDeclinedClaim($claimId))
{
} elseif (ArrayHelper::getValue($this->claim->info->dataArray, 'step') == 6 && $this-
>isDeclinedClaim($claimId)) {
$event = new ClaimCommunicationEvent();
$event->claim = $this->claim;
/** ----==== EVENT_CLAIM_COMMUNICATION_FAILURE ====---- */
$this->trigger(self::EVENT_CLAIM_COMMUNICATION_FAILURE, $event);
}
}
return true;
}
return false;
}
private function getOuterMessage(): string
{
if (!$result = Json::encode(['WS' => array_merge($this->getHeader(), $this->getBody())])) {
throw new ErrorException('Не удалось сформировать исходящее сообщение.');
}
return $result;
}
/**
* Getting header of outgoing message for rabbit queue
*
* @return array
*/
private function getHeader(): array
{
$passage = $this->getPassage();
switch ($passage) {
case self::TRANSPORTER_PASSAGE_CREATE_CASH_RQ:
case self::TRANSPORTER_PASSAGE_UPDATE_CASH_RQ:
$bp = self::BP_STEP_SYNC_CHANNEL_SIEBEL_APPL_RQ;
$docTypeInMsg = self::DOC_TYPE_IN_MSG_SYNC_CHANNEL_SIEBEL_APPL_RQ;
break;
case self::TRANSPORTER_PASSAGE_ACCEPT_CASH_RQ:
case self::TRANSPORTER_PASSAGE_DECLINE_ALL_CASH_RQ:
$bp = self::BP_STEP_ASYNC_CHANNEL_SIEBEL_APPL_DECISION_RQ;
$docTypeInMsg = self::DOC_TYPE_IN_MSG_ASYNC_CHANNEL_SIEBEL_APPL_DECISION_RQ;
break;
default:
$bp = self::BP_STEP_SYNC_CHANNEL_SIEBEL_APPL_RQ;
$docTypeInMsg = self::DOC_TYPE_IN_MSG_SYNC_CHANNEL_SIEBEL_APPL_RQ;
}
$header = [
116
'ID' => $this->getRqUid(),
'SENDER' => 'SDP',
'RECEIVER' => $this->receiver,
'BANK' => self::BANK_SKB,
'ROLEMSG' => 'Request',
'TYPEMSG' => 'Application',
'SENDTIME' => DateTimeHelper::dateFormatModification(self::MESSAGE_TIME_FORMAT, 'Y-
m-d H:i:s', date('Y-m-d H:i:s'), false),
'PRIORITY' => '4',
'DOCTYPEINMSG' => $docTypeInMsg,
'BP' => $bp,
];
return ['HEADER' => $header];
}
/**
* @return array
* @throws ErrorException
* @see
getCreateNewRequestMessage,getUpdateRequestMessage,getAcceptRequestMessage,getDeclineAll
OffersMessage,getCloseRequestMessage,getOkMessage
*/
private function getBody(): array
{
$requestMethod = 'get' . $this->getRequestForPassage() . 'Message';
if (!method_exists($this, $requestMethod)) {
throw new ErrorException('Incorrect request method');
}
$result = $this->{$requestMethod}();
ksort($result);
return [
'BODY' => $result
];
}
/**
* Getting code of citizenship
*
* @param $value
* @return string|null
*/
public function getCitizenshipCode($value)
{
$result = null;
if ($value == 'Yes') {
$result = '643';
}
return $result;
}

Смотрите также:

"Автоматизация обработки заявок ООО "Проектно-Строительная Компания"
"Автоматизация процесса аттестации персонала для ООО "Нэт Бай Нэт Холдинг"
"Анализ интернет-активности конкурентов ( на примере конкурентов "Газпром нефть")
"Бухгалтерский учёт и аудит расчётов с подотчётними лицами в организации на примере ООО "ЛОЦ 10""
«Психологическое сопровождение персонала в организации на примере ООО «Крокус»
Cовершенствование деловой оценки персонала в организации (на примере ООО "Даймонд кейтеринг развитие")
IPO - инструмент финансирования деятельности организации. На примере ПАО «Нефтяная компания «Лукойл»
PR как средство продвижения организации (на примере ПАО "Тамбовский завод "Комсомолец им. Н.С. Артемова")
PR-коммуникации в сфере общественного питания (на примере кафе-кондитерской «Cream Cheese»)
SMM как средство повышения эффективности работы учреждений социокультурной сферы (на примере Малого театра)