현장확인매물 상세 페이지 기능 수정
This commit is contained in:
@@ -76,6 +76,8 @@ $routes->group('', ['namespace' => 'App\Controllers\Article'], static function (
|
|||||||
$routes->post('chgStatus', 'Receipt::chgStatus'); // 상태변경
|
$routes->post('chgStatus', 'Receipt::chgStatus'); // 상태변경
|
||||||
$routes->post('sendSms', 'Receipt::sendSms'); // 문자발송
|
$routes->post('sendSms', 'Receipt::sendSms'); // 문자발송
|
||||||
$routes->post('saveRecInfo', 'Receipt::saveRecInfo'); // 거주인정보저장
|
$routes->post('saveRecInfo', 'Receipt::saveRecInfo'); // 거주인정보저장
|
||||||
|
$routes->get('getRecInfo', 'Receipt::getRecInfo'); // 거주인정보조회
|
||||||
|
$routes->get('getHistory', 'Receipt::getHistory'); // 정보변경이력조회
|
||||||
$routes->get('getImages', 'Receipt::getImages'); // 이미지 목록 조회
|
$routes->get('getImages', 'Receipt::getImages'); // 이미지 목록 조회
|
||||||
$routes->post('uploadFile', 'Receipt::uploadFile'); // 파일업로드
|
$routes->post('uploadFile', 'Receipt::uploadFile'); // 파일업로드
|
||||||
$routes->post('removeUploadFile', 'Receipt::removeUploadFile'); // 파일삭제
|
$routes->post('removeUploadFile', 'Receipt::removeUploadFile'); // 파일삭제
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ use CodeIgniter\Router\RouteCollection;
|
|||||||
/** @var RouteCollection $routes */
|
/** @var RouteCollection $routes */
|
||||||
|
|
||||||
$routes->group('kiso', function(RouteCollection $routes) {
|
$routes->group('kiso', function(RouteCollection $routes) {
|
||||||
$routes->match(['get', 'post'], 'api/vrfcReq', 'KisoController::vrfcReq');
|
$routes->match(['GET', 'POST'], 'api/vrfcReq', 'KisoController::vrfcReq');
|
||||||
});
|
});
|
||||||
@@ -202,7 +202,8 @@ class Receipt extends BaseController
|
|||||||
log_message('info', '[Receipt::detail] getDetail {ms}ms', ['ms' => (int) ((microtime(true) - $t3) * 1000)]);
|
log_message('info', '[Receipt::detail] getDetail {ms}ms', ['ms' => (int) ((microtime(true) - $t3) * 1000)]);
|
||||||
|
|
||||||
$t4 = microtime(true);
|
$t4 = microtime(true);
|
||||||
$history = $this->model->getHistory($id);
|
// rcpt_sq를 사용하여 이력 조회
|
||||||
|
$history = $this->model->getHistory($data['rcpt_sq'] ?? $id);
|
||||||
log_message('info', '[Receipt::detail] getHistory {ms}ms', ['ms' => (int) ((microtime(true) - $t4) * 1000)]);
|
log_message('info', '[Receipt::detail] getHistory {ms}ms', ['ms' => (int) ((microtime(true) - $t4) * 1000)]);
|
||||||
|
|
||||||
$t5 = microtime(true);
|
$t5 = microtime(true);
|
||||||
@@ -346,23 +347,52 @@ class Receipt extends BaseController
|
|||||||
|
|
||||||
$this->model->saveResDB($rcpt_sq, $rsrv_sq, $res_yn, $dbUsageAgrYn);
|
$this->model->saveResDB($rcpt_sq, $rsrv_sq, $res_yn, $dbUsageAgrYn);
|
||||||
|
|
||||||
$receipt = $this->getDetail($rcpt_key);
|
$receipt = $this->model->getDetail($rcpt_key);
|
||||||
if ($res_yn == 'Y') {
|
if ($res_yn == 'Y') {
|
||||||
$isResidentsExist = true;
|
$isResidentsExist = true;
|
||||||
} else {
|
} else {
|
||||||
$isResidentsExist = false;
|
$isResidentsExist = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$api_result = $naver->residentsExistence($rcpt_key, $isResidentsExist);
|
$updateData = [
|
||||||
|
'residentsExistence' => $isResidentsExist
|
||||||
|
];
|
||||||
|
|
||||||
|
$charger = session('usr_id');
|
||||||
|
|
||||||
if (!isset($api_result['result'])) {
|
log_message('info', '[resDbYn] 네이버 API 호출 시작 - rcpt_key: ' . $rcpt_key . ', charger: ' . $charger . ', updateData: ' . json_encode($updateData, JSON_UNESCAPED_UNICODE));
|
||||||
throw new \Exception('API 통신오류입니다.\n다시 저장하여 주십시요.');
|
|
||||||
|
$api_result = $naver->updateArticleInfo($rcpt_key, $updateData, $charger);
|
||||||
|
|
||||||
|
log_message('info', '[resDbYn] 네이버 API 응답 - result: ' . json_encode($api_result, JSON_UNESCAPED_UNICODE) . ' (type: ' . gettype($api_result) . ')');
|
||||||
|
|
||||||
|
// API 호출 실패 체크
|
||||||
|
if (isset($api_result['error']) && $api_result['error'] === true) {
|
||||||
|
// 에러 정보를 상세하게 표시
|
||||||
|
if ($api_result['error_type'] === 'CURL_ERROR') {
|
||||||
|
$errorMsg = "네이버 API 통신 실패 (CURL 오류)\n";
|
||||||
|
$errorMsg .= "오류코드: {$api_result['curl_errno']}\n";
|
||||||
|
$errorMsg .= "오류내용: {$api_result['curl_error']}\n";
|
||||||
|
$errorMsg .= "URL: {$api_result['url']}";
|
||||||
|
} else {
|
||||||
|
$errorMsg = "네이버 API 응답 오류 (HTTP {$api_result['http_code']})\n";
|
||||||
|
$errorMsg .= "응답내용: {$api_result['response']}\n";
|
||||||
|
$errorMsg .= "URL: {$api_result['url']}";
|
||||||
|
}
|
||||||
|
throw new \Exception($errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 정상 응답이지만 성공이 아닌 경우
|
||||||
|
if (!isset($api_result['code']) || $api_result['code'] !== 'success') {
|
||||||
|
$errorMsg = "네이버 API 응답 오류\n";
|
||||||
|
$errorMsg .= "응답: " . json_encode($api_result, JSON_UNESCAPED_UNICODE);
|
||||||
|
throw new \Exception($errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'code' => '0',
|
'code' => '0',
|
||||||
'msg' => 'success'
|
'msg' => 'success',
|
||||||
|
'debug_api_result' => $api_result // 디버그용 (확인 후 제거)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -425,7 +455,7 @@ class Receipt extends BaseController
|
|||||||
$na_result = $naver->reserveSuccess($rcpt_key, 'Y', $bonbuInfo['dept_nm'], $deptInfo['dept_nm'], $userInfo['usr_nm'], $userInfo['usr_tel1'], $rsrv_date, $rsrv_tm_ap);
|
$na_result = $naver->reserveSuccess($rcpt_key, 'Y', $bonbuInfo['dept_nm'], $deptInfo['dept_nm'], $userInfo['usr_nm'], $userInfo['usr_tel1'], $rsrv_date, $rsrv_tm_ap);
|
||||||
/*** 네이버 연동[e] ***/
|
/*** 네이버 연동[e] ***/
|
||||||
|
|
||||||
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
|
if (isset($na_result['code']) && $na_result['code'] === 'success') { //네이버연동 상태변경 완료
|
||||||
$result = $this->model->assignRegist($rcpt_sq, $rsrv_date, $rsrv_tm_ap, $rsrv_tm_hour, $dept_sq, $usr_sq, $receipt);
|
$result = $this->model->assignRegist($rcpt_sq, $rsrv_date, $rsrv_tm_ap, $rsrv_tm_hour, $dept_sq, $usr_sq, $receipt);
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
@@ -433,7 +463,7 @@ class Receipt extends BaseController
|
|||||||
'msg' => 'success'
|
'msg' => 'success'
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception($na_result['message']);
|
throw new \Exception($na_result['message'] ?? '네이버 API 연동 실패');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -530,11 +560,11 @@ class Receipt extends BaseController
|
|||||||
}
|
}
|
||||||
/*** 네이버 연동[e] ***/
|
/*** 네이버 연동[e] ***/
|
||||||
|
|
||||||
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
|
if (isset($na_result['code']) && $na_result['code'] === 'success') { //네이버연동 상태변경 완료
|
||||||
$result = $this->model->rsrvcancel($rcpt_sq, $rsrv_sq, $result_cd2, $result_cd3, $result_msg, $receipt);
|
$result = $this->model->rsrvcancel($rcpt_sq, $rsrv_sq, $result_cd2, $result_cd3, $result_msg, $receipt);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception($na_result['message']);
|
throw new \Exception($na_result['message'] ?? '네이버 API 연동 실패');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
@@ -644,7 +674,6 @@ class Receipt extends BaseController
|
|||||||
$lib = new MyUpload();
|
$lib = new MyUpload();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
$rcpt_sq = $this->request->getPost('rcpt_sq');
|
||||||
$rcpt_key = $this->request->getPost('rcpt_key');
|
$rcpt_key = $this->request->getPost('rcpt_key');
|
||||||
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||||
@@ -657,8 +686,6 @@ class Receipt extends BaseController
|
|||||||
$rec_nm = $this->request->getPost('rec_nm');
|
$rec_nm = $this->request->getPost('rec_nm');
|
||||||
$rec_remark = $this->request->getPost('rec_remark');
|
$rec_remark = $this->request->getPost('rec_remark');
|
||||||
|
|
||||||
$file = $this->request->getFile('rec_file');
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'rcpt_sq' => $rcpt_sq,
|
'rcpt_sq' => $rcpt_sq,
|
||||||
'rsrv_sq' => $rsrv_sq,
|
'rsrv_sq' => $rsrv_sq,
|
||||||
@@ -668,43 +695,101 @@ class Receipt extends BaseController
|
|||||||
'rec_remark' => $rec_remark,
|
'rec_remark' => $rec_remark,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// 파일 업로드 처리
|
||||||
|
$file = $this->request->getFile('rec_file');
|
||||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||||
|
|
||||||
$uploadPath = "/upload/result/" . $rsrv_sq . "/";
|
$uploadPath = "/upload/result/" . $rsrv_sq . "/";
|
||||||
|
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||||
|
|
||||||
$arrUploadfile = [];
|
if ($uploadData !== false && is_array($uploadData)) {
|
||||||
if ($file->isValid() && !$file->hasMoved()) {
|
// do_upload2 반환값 구조: object_key, object_storage_url, origin_name, file_name, base_name, ext
|
||||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
$data['file'] = [
|
||||||
|
'upload_path' => $uploadPath,
|
||||||
if ($uploadData !== false) {
|
'file_name' => isset($uploadData['file_name']) ? $uploadData['file_name'] : '',
|
||||||
$arrUploadfile[] = $uploadData;
|
'origin_name' => isset($uploadData['origin_name']) ? $uploadData['origin_name'] : '',
|
||||||
}
|
'ext' => isset($uploadData['ext']) ? $uploadData['ext'] : '',
|
||||||
|
'size' => $file->getSize(),
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
throw new \Exception('파일 업로드에 실패했습니다.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrUploadfile)) {
|
|
||||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
|
||||||
$data['file'] = [
|
|
||||||
'orig_name' => $uploadFile['origin_name'],
|
|
||||||
'new_name' => $uploadFile['file_name'],
|
|
||||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
|
||||||
'ext' => '.' . $uploadFile['ext'],
|
|
||||||
'size' => $file->getSize(),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->model->saveRecInfo($data);
|
$result = $this->model->saveRecInfo($data);
|
||||||
|
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'code' => '0',
|
'code' => '0',
|
||||||
'msg' => 'success'
|
'msg' => 'success',
|
||||||
|
'data' => [
|
||||||
|
'rec_tel' => $result['rec_tel'] ?? '',
|
||||||
|
'rec_nm' => $result['rec_nm'] ?? '',
|
||||||
|
'remark' => $result['remark'] ?? '',
|
||||||
|
'record' => $result['record'] ?? null
|
||||||
|
]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', '[Receipt::saveRecInfo] Error: ' . $e->getMessage());
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 거주인 정보 조회
|
||||||
|
public function getRecInfo()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$rcpt_sq = $this->request->getGet('rcpt_sq');
|
||||||
|
|
||||||
|
if (empty($rcpt_sq)) {
|
||||||
|
throw new \Exception('rcpt_sq가 필요합니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 거주인 정보 조회
|
||||||
|
$recInfo = $this->model->getRecInfoByRcptSq($rcpt_sq);
|
||||||
|
|
||||||
|
if (empty($recInfo)) {
|
||||||
|
throw new \Exception('거주인 정보를 찾을 수 없습니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
'data' => $recInfo
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', '[Receipt::getRecInfo] Error: ' . $e->getMessage());
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 정보변경 이력 조회
|
||||||
|
public function getHistory()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$rcpt_sq = $this->request->getGet('rcpt_sq');
|
||||||
|
|
||||||
|
if (empty($rcpt_sq)) {
|
||||||
|
throw new \Exception('rcpt_sq가 필요합니다.');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 정보변경 이력 조회
|
||||||
|
$history = $this->model->getHistory($rcpt_sq);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
'data' => $history ?? []
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', '[Receipt::getHistory] Error: ' . $e->getMessage());
|
||||||
return $this->response->setJSON([
|
return $this->response->setJSON([
|
||||||
'code' => '9',
|
'code' => '9',
|
||||||
'msg' => $e->getMessage(),
|
'msg' => $e->getMessage(),
|
||||||
|
|||||||
@@ -41,12 +41,34 @@ class NaverApiClient
|
|||||||
* object $space 면적정보[비공동] (supplySpace,exclusiveSpace,totalSpace,groundSpace,buildingSpace)
|
* object $space 면적정보[비공동] (supplySpace,exclusiveSpace,totalSpace,groundSpace,buildingSpace)
|
||||||
* object $facilities 비공동시설정보 (roomCount)
|
* object $facilities 비공동시설정보 (roomCount)
|
||||||
*/
|
*/
|
||||||
|
/** 현장확인 수정시 */
|
||||||
public function updateArticleInfo(string $articleNumber, array $updateData, string $charger = 'admin'): ?array
|
public function updateArticleInfo(string $articleNumber, array $updateData, string $charger = 'admin'): ?array
|
||||||
|
{
|
||||||
|
$this->charger = $charger;
|
||||||
|
$url = "{$this->baseUrl}/kiso/center/verification-site/{$articleNumber}?charger={$this->charger}";
|
||||||
|
|
||||||
|
log_message('info', "[updateArticleInfo] 호출됨 - URL: {$url}, 데이터: " . json_encode($updateData, JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
|
$result = $this->request('PUT', $url, $updateData);
|
||||||
|
|
||||||
|
log_message('info', "[updateArticleInfo] 결과 - " . ($result === null ? 'NULL' : json_encode($result, JSON_UNESCAPED_UNICODE)));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 일반매물 수정시 */
|
||||||
|
public function v2updateArticleInfo(string $articleNumber, array $updateData, string $charger = 'admin'): ?array
|
||||||
{
|
{
|
||||||
$this->charger = $charger;
|
$this->charger = $charger;
|
||||||
$url = "{$this->baseUrl}/kiso/center/verification-article/{$articleNumber}?charger={$this->charger}";
|
$url = "{$this->baseUrl}/kiso/center/verification-article/{$articleNumber}?charger={$this->charger}";
|
||||||
|
|
||||||
return $this->request('PUT', $url, $updateData);
|
log_message('info', "[v2updateArticleInfo] 호출됨 - URL: {$url}, 데이터: " . json_encode($updateData, JSON_UNESCAPED_UNICODE));
|
||||||
|
|
||||||
|
$result = $this->request('PUT', $url, $updateData);
|
||||||
|
|
||||||
|
log_message('info', "[v2updateArticleInfo] 결과 - " . ($result === null ? 'NULL' : json_encode($result, JSON_UNESCAPED_UNICODE)));
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -525,7 +547,13 @@ class NaverApiClient
|
|||||||
// CURL 오류 체크
|
// CURL 오류 체크
|
||||||
if ($curlErrno !== 0) {
|
if ($curlErrno !== 0) {
|
||||||
log_message('error', "[Naver API $method CURL ERROR] URL: $url | Error ($curlErrno): $curlError");
|
log_message('error', "[Naver API $method CURL ERROR] URL: $url | Error ($curlErrno): $curlError");
|
||||||
return null;
|
return [
|
||||||
|
'error' => true,
|
||||||
|
'error_type' => 'CURL_ERROR',
|
||||||
|
'curl_errno' => $curlErrno,
|
||||||
|
'curl_error' => $curlError,
|
||||||
|
'url' => $url
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 결과 로그 기록 (성공/실패 모두 기록하여 추적 가능하게 함)
|
// 결과 로그 기록 (성공/실패 모두 기록하여 추적 가능하게 함)
|
||||||
@@ -533,7 +561,13 @@ class NaverApiClient
|
|||||||
log_message('info', "[Naver API $method SUCCESS] URL: $url | Code: $httpCode | Response: $response");
|
log_message('info', "[Naver API $method SUCCESS] URL: $url | Code: $httpCode | Response: $response");
|
||||||
} else {
|
} else {
|
||||||
log_message('error', "[Naver API $method FAIL] URL: $url | Code: $httpCode | Response: $response");
|
log_message('error', "[Naver API $method FAIL] URL: $url | Code: $httpCode | Response: $response");
|
||||||
return null;
|
return [
|
||||||
|
'error' => true,
|
||||||
|
'error_type' => 'HTTP_ERROR',
|
||||||
|
'http_code' => $httpCode,
|
||||||
|
'response' => $response,
|
||||||
|
'url' => $url
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return json_decode($response, true);
|
return json_decode($response, true);
|
||||||
|
|||||||
@@ -1309,17 +1309,29 @@ class ReceiptModel extends Model
|
|||||||
// 정보변경이력
|
// 정보변경이력
|
||||||
public function getHistory($id)
|
public function getHistory($id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rcpt_sq FROM receipt WHERE rcpt_key = ?";
|
// $id가 숫자면 rcpt_sq로 간주, 아니면 rcpt_key로 간주
|
||||||
$query = $query = $this->db->query($sql, [$id]);
|
if (is_numeric($id) && strpos($id, '-') === false) {
|
||||||
$rcpt_sq = $query->getRow()->rcpt_sq;
|
// 순수 숫자면 rcpt_sq로 직접 사용
|
||||||
|
$rcpt_sq = $id;
|
||||||
|
} else {
|
||||||
|
// rcpt_key로 간주하고 rcpt_sq 조회
|
||||||
|
$sql = "SELECT rcpt_sq FROM receipt WHERE rcpt_key = ?";
|
||||||
|
$query = $this->db->query($sql, [$id]);
|
||||||
|
$row = $query->getRow();
|
||||||
|
if ($row) {
|
||||||
|
$rcpt_sq = $row->rcpt_sq;
|
||||||
|
} else {
|
||||||
|
log_message('warning', "[ReceiptModel::getHistory] rcpt_key '{$id}'에 해당하는 receipt를 찾을 수 없습니다.");
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "SELECT seq" .
|
$sql = "SELECT seq" .
|
||||||
" ,rcpt_sq" .
|
" ,rcpt_sq" .
|
||||||
" ,rcpt_stat" .
|
" ,rcpt_stat" .
|
||||||
" ,get_code_name('RECEIPT_STATUS3', rcpt_stat) AS rcpt_stat_nm" .
|
" ,get_code_name('RECEIPT_STATUS3', rcpt_stat) AS rcpt_stat_nm" .
|
||||||
" ,rcpt_stat" .
|
|
||||||
" ,get_code_name('CHANGED_TYPE', changed_type) AS changed_type_nm" .
|
|
||||||
" ,changed_type" .
|
" ,changed_type" .
|
||||||
|
" ,get_code_name('CHANGED_TYPE', changed_type) AS changed_type_nm" .
|
||||||
" ,changed_id" .
|
" ,changed_id" .
|
||||||
" ,remark" .
|
" ,remark" .
|
||||||
" ,DATE_FORMAT(changed_tm, '%Y.%m.%d %H:%i:%s') as changed_tm" .
|
" ,DATE_FORMAT(changed_tm, '%Y.%m.%d %H:%i:%s') as changed_tm" .
|
||||||
@@ -1434,12 +1446,14 @@ class ReceiptModel extends Model
|
|||||||
// 녹취파일정보
|
// 녹취파일정보
|
||||||
public function getRecordInfo($rsrv_sq)
|
public function getRecordInfo($rsrv_sq)
|
||||||
{
|
{
|
||||||
$sql = "SELECT record_sq, rsrv_sq, use_yn, record_path, record_filenm, record_orignm, record_size, record_tel, record_nm, record_dt, remark, insert_usr, insert_tm, update_usr, update_tm" .
|
$sql = "SELECT record_sq, rsrv_sq, use_yn, record_path, record_filenm, record_orignm, record_size, record_tel, record_nm, record_dt, remark, insert_usr, DATE_FORMAT(insert_tm, '%Y-%m-%d %H:%i') as insert_tm, update_usr, update_tm" .
|
||||||
" FROM result_record" .
|
" FROM result_record" .
|
||||||
" WHERE rsrv_sq = ?" .
|
" WHERE rsrv_sq = ?" .
|
||||||
|
" AND use_yn = 'Y'" .
|
||||||
" AND record_sq = (SELECT MAX(record_sq)" .
|
" AND record_sq = (SELECT MAX(record_sq)" .
|
||||||
" FROM result_record" .
|
" FROM result_record" .
|
||||||
" WHERE rsrv_sq = ?)";
|
" WHERE rsrv_sq = ?" .
|
||||||
|
" AND use_yn = 'Y')";
|
||||||
$data = array(
|
$data = array(
|
||||||
$rsrv_sq,
|
$rsrv_sq,
|
||||||
$rsrv_sq
|
$rsrv_sq
|
||||||
@@ -1489,7 +1503,11 @@ class ReceiptModel extends Model
|
|||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
$usr_id = session('usr_id');
|
$usr_id = session('usr_id');
|
||||||
|
|
||||||
$sql = "SELECT result_cd3, resYn, dbUsageAgrYn FROM result WHERE rsrv_sq = ?";
|
// 변경 전 데이터와 현재 상태 조회
|
||||||
|
$sql = "SELECT r.result_cd3, r.resYn, r.dbUsageAgrYn, rc.rcpt_stat
|
||||||
|
FROM result r
|
||||||
|
LEFT JOIN receipt rc ON rc.rcpt_sq = r.rcpt_sq
|
||||||
|
WHERE r.rsrv_sq = ?";
|
||||||
$data = array($rsrv_sq);
|
$data = array($rsrv_sq);
|
||||||
$query = $this->db->query($sql, $data);
|
$query = $this->db->query($sql, $data);
|
||||||
$row = $query->getRowArray();
|
$row = $query->getRowArray();
|
||||||
@@ -1508,7 +1526,13 @@ class ReceiptModel extends Model
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->saveChangedHistory($rcpt_sq, $row['result_cd3'], 'C24', $usr_id, $row['resYn'] . "|" . $row['dbUsageAgrYn']);
|
// 정보변경 이력 저장 (변경 전 → 변경 후)
|
||||||
|
$before = "거주:" . ($row['resYn'] ?? 'N') . ", DB동의:" . ($row['dbUsageAgrYn'] ?? 'N');
|
||||||
|
$after = "거주:" . $resYn . ", DB동의:" . $dbUsageAgrYn;
|
||||||
|
$remark = $before . " => " . $after;
|
||||||
|
$rcpt_stat = $row['rcpt_stat'] ?? $row['result_cd3'] ?? '100000';
|
||||||
|
|
||||||
|
$this->saveChangedHistory($rcpt_sq, $rcpt_stat, 'C36', $usr_id, $remark);
|
||||||
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
@@ -1521,6 +1545,12 @@ class ReceiptModel extends Model
|
|||||||
public function saveGround($rcpt_sq, $ground_plan)
|
public function saveGround($rcpt_sq, $ground_plan)
|
||||||
{
|
{
|
||||||
$this->db->transStart();
|
$this->db->transStart();
|
||||||
|
$usr_id = session('usr_id');
|
||||||
|
|
||||||
|
// 변경 전 데이터 조회
|
||||||
|
$sql = "SELECT ground_plan, rcpt_stat FROM receipt WHERE rcpt_sq = ?";
|
||||||
|
$query = $this->db->query($sql, [$rcpt_sq]);
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
|
||||||
$sql = "UPDATE receipt" .
|
$sql = "UPDATE receipt" .
|
||||||
" SET ground_plan = ?" .
|
" SET ground_plan = ?" .
|
||||||
@@ -1535,6 +1565,10 @@ class ReceiptModel extends Model
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 정보변경 이력 저장
|
||||||
|
$remark = "평면도요청: " . ($row['ground_plan'] ?? 'N') . " => " . $ground_plan;
|
||||||
|
$this->saveChangedHistory($rcpt_sq, $row['rcpt_stat'], 'C37', $usr_id, $remark);
|
||||||
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -1810,11 +1844,48 @@ class ReceiptModel extends Model
|
|||||||
|
|
||||||
$this->db->transComplete();
|
$this->db->transComplete();
|
||||||
|
|
||||||
|
// 저장 후 최신 거주인 정보 반환
|
||||||
|
$record = $this->getRecordInfo($data['rsrv_sq']);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'success' => true,
|
'success' => true,
|
||||||
|
'rec_tel' => $data['rec_tel'],
|
||||||
|
'rec_nm' => $data['rec_nm'],
|
||||||
|
'remark' => $data['rec_remark'],
|
||||||
|
'record' => $record
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 거주인 정보 조회
|
||||||
|
public function getRecInfoByRcptSq($rcpt_sq)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
// 기존 getDetail 메서드 활용 (이미 최적화된 쿼리)
|
||||||
|
$data = $this->getDetail($rcpt_sq);
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
log_message('error', '[ReceiptModel::getRecInfoByRcptSq] Receipt not found for rcpt_sq: ' . $rcpt_sq);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 녹취파일 정보 조회 (기존 getRecordInfo 활용)
|
||||||
|
$record = null;
|
||||||
|
if (!empty($data['rsrv_sq'])) {
|
||||||
|
$record = $this->getRecordInfo($data['rsrv_sq']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'rec_tel' => $data['rec_tel'] ?? '',
|
||||||
|
'rec_nm' => $data['rec_nm'] ?? '',
|
||||||
|
'remark' => $data['remark'] ?? '',
|
||||||
|
'record' => $record ?: null
|
||||||
|
];
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
log_message('error', '[ReceiptModel::getRecInfoByRcptSq] Exception: ' . $e->getMessage());
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 워터마크 조회
|
// 워터마크 조회
|
||||||
public function getWatermarkList($rcpt_cpid)
|
public function getWatermarkList($rcpt_cpid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2675,9 +2675,10 @@ $usr_level = session('usr_level');
|
|||||||
title: "정상 처리되었습니다.",
|
title: "정상 처리되었습니다.",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
draggable: true
|
draggable: true
|
||||||
})
|
}).then(() => {
|
||||||
|
// 녹취파일 체크박스 활성화 및 체크
|
||||||
location.reload();
|
$('#chk_record').prop('disabled', false).prop('checked', true);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: result.msg,
|
title: result.msg,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2675,9 +2675,10 @@ $usr_level = session('usr_level');
|
|||||||
title: "정상 처리되었습니다.",
|
title: "정상 처리되었습니다.",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
draggable: true
|
draggable: true
|
||||||
})
|
}).then(() => {
|
||||||
|
// 녹취파일 체크박스 활성화 및 체크
|
||||||
location.reload();
|
$('#chk_record').prop('disabled', false).prop('checked', true);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: result.msg,
|
title: result.msg,
|
||||||
|
|||||||
2210
public/js/article/receipt/detail.js
Normal file
2210
public/js/article/receipt/detail.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user