worker service 매물 등록 및 redis 다운시 처리
This commit is contained in:
@@ -53,9 +53,17 @@ class TypeSHandler
|
||||
|
||||
// 2. Result 데이터 저장
|
||||
$resultData = $this->parameterMapper->mapResult($rcptSq, $rawData);
|
||||
write_custom_log("Result Insert 데이터: " . json_encode($resultData, JSON_UNESCAPED_UNICODE), 'INFO', 'service');
|
||||
|
||||
if (!$this->resultModel->insert($resultData)) {
|
||||
throw new Exception("Result Insert 실패");
|
||||
$lastQuery = (string)$this->resultModel->getLastQuery();
|
||||
$errors = json_encode($this->resultModel->errors());
|
||||
write_custom_log("Result Insert 실패 | SQL: $lastQuery | Errors: $errors", 'ERROR', 'service');
|
||||
throw new Exception("Result Insert 실패: $errors");
|
||||
}
|
||||
|
||||
$insertedResultSql = (string)$this->resultModel->getLastQuery();
|
||||
write_custom_log("Result Insert 성공 | SQL: $insertedResultSql", 'INFO', 'service');
|
||||
CLI::write(CLI::color('✅ Result 저장 성공', 'blue'));
|
||||
|
||||
// 3. 트랜잭션 커밋
|
||||
|
||||
@@ -115,21 +115,39 @@ class TypeSParameterMapper extends BaseParameterMapper
|
||||
$charge = null;
|
||||
if ($sectorNumber) {
|
||||
$charge = $this->regionModel->getChargeByRegionCd($sectorNumber);
|
||||
log_message('info', "[TypeSParameterMapper] 지역코드: {$sectorNumber}, 조회 결과: " . json_encode($charge, JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
// 2. 기본 담당자 설정 (지역별 담당자가 없으면)
|
||||
$deptSq = $charge['dept_sq'] ?? '26';
|
||||
$usrSq = $charge['usr_sq'] ?? '1';
|
||||
|
||||
// 담당자 존재 여부 검증 (users 테이블 확인)
|
||||
if ($usrSq && $usrSq !== '1') {
|
||||
$db = \Config\Database::connect();
|
||||
$userExists = $db->table('users')->where('usr_sq', $usrSq)->countAllResults() > 0;
|
||||
if (!$userExists) {
|
||||
log_message('warning', "[TypeSParameterMapper] usr_sq={$usrSq}가 users 테이블에 없음. 기본값(1)으로 폴백");
|
||||
$usrSq = '1';
|
||||
$deptSq = '26';
|
||||
}
|
||||
}
|
||||
|
||||
log_message('info', "[TypeSParameterMapper] 기본 담당자 - dept_sq: {$deptSq}, usr_sq: {$usrSq}, VR검증: " . ($isVrVerification ? 'Y' : 'N'));
|
||||
|
||||
// 3. VR 검증인 경우 환경별 담당자로 덮어쓰기
|
||||
if ($isVrVerification) {
|
||||
log_message('info', "[TypeSParameterMapper] ENVIRONMENT 상수 값: " . ENVIRONMENT);
|
||||
|
||||
if (ENVIRONMENT === 'development') {
|
||||
$deptSq = '29';
|
||||
$usrSq = '472';
|
||||
$usrSq = '472'; // vradmin
|
||||
log_message('info', "[TypeSParameterMapper] VR 검증 (DEV) - dept_sq: {$deptSq}, usr_sq: {$usrSq}");
|
||||
} else {
|
||||
// production
|
||||
$deptSq = '33';
|
||||
$usrSq = '1993';
|
||||
// production - TODO: 실제 프로덕션 VR 담당자로 변경 필요
|
||||
$deptSq = '29';
|
||||
$usrSq = '472'; // 임시: vradmin (프로덕션 VR 담당자 확인 후 수정)
|
||||
log_message('warning', "[TypeSParameterMapper] VR 검증 (PROD) - 프로덕션 VR 담당자 미설정, 임시 담당자 사용: usr_sq={$usrSq}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user