상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled

This commit is contained in:
yangsh
2026-02-05 12:41:07 +09:00
parent 36355f75f3
commit 790216404c
8 changed files with 1108 additions and 29 deletions

View File

@@ -1,6 +1,8 @@
<?php
namespace App\Models\v2;
use App\Models\receipt\ReceiptModel;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M708Model extends Model
@@ -961,7 +963,7 @@ class M708Model extends Model
$current_tm = date('Y-m-d H:i:s');
$article = $this->getArticleInfo2($atcl_no, $vr_sq);
$this->saveFaxImgs($fax_sq, '2', $vr_sq, $atcl_no, $article['cpid'], $article['realtor_nm'], $article['stat_cd'], $current_tm, $article['address_code'], $article['address2']);
$this->saveFaxImgs($fax_sq, '2', $vr_sq, $atcl_no, $article['cpid'], $article['realtor_nm'], $article['stat_cd'], $current_tm, $article['address_code'], $article['address2'], 'Y');
return [
'success' => true,
@@ -1215,6 +1217,754 @@ class M708Model extends Model
return $row;
}
/**
* 매물정보와 FAX를 연결해 준다.
*/
public function saveArticleFAX($memo, $fax_sq, $vr_sq, $atcl_no, $work_type, $result_d11, $comment_d11, $fax_conf_yn_1, $fax_conf_yn_2, $fax_conf_yn_3, $fax_conf_info_1, $fax_conf_info_2, $fax_conf_info_3, $stat_cd = '')
{
// 1. 매물정보 저장 fax_imgs
// 2.1 확인결과 저장 v2_confirms
// 2.2 확인정보 체크 v2_check_list
// 3.1 검증요청 상태변경 v2_vrfc_req
// 3.2 상태변경 저장 v2_chg_stat
// 4. 첨부파일 저장 v2_files
// 5. 변경이력 저장 v2_chg_history
// 6. kiso 전송하기
$this->db->transStart();
$article = NULL;
$current_tm = date('Y-m-d H:i:s');
$insert_user = session('usr_sq');
$insert_id = session('usr_id');
$update_user = $insert_user;
switch ($work_type) {
case '1': // 현장확인매물
$article = $this->getArticleInfo1($atcl_no, $vr_sq);
// 1. 매물정보 저장 fax_imgs
$this->saveFaxImgs($fax_sq, $work_type, $vr_sq, $atcl_no, $article['cpid'], $article['realtor_nm'], '35', $current_tm, $article['address_code'], $article['address2'], 'Y');
// 2.1 확인결과 저장 v2_confirm
if ($result_d11 == '10000' && $fax_conf_yn_1 == 'Y' && $fax_conf_yn_2 == 'Y' && $fax_conf_yn_3 == 'Y') {
$success = TRUE;
} else {
$success = FALSE;
}
$fax = $this->getDetail($fax_sq);
$this->saveV2Confirm($vr_sq, 'D', $success, '1', $fax['charger'], $current_tm, $insert_user, $update_user, $work_type);
// 2.2 확인정보 체크 v2_check_list
// $fax_conf_yn_1, $fax_conf_yn_2, $fax_conf_yn_3,
// $fax_conf_info_1, $fax_conf_info_2, $fax_conf_info_3
if (is_array($comment_d11)) {
$comment = implode('|', $comment_d11);
} else {
$comment = $comment_d11;
}
$this->saveV2CheckList($vr_sq, 'D', 'D11', $result_d11, $comment, $insert_user);
if ($fax_conf_yn_1 == 'Y') {
$fax_conf_yn_1 = '10000';
} else {
$fax_conf_yn_1 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D12', $fax_conf_yn_1, $fax_conf_info_1, $insert_user);
if ($fax_conf_yn_2 == 'Y') {
$fax_conf_yn_2 = '10000';
} else {
$fax_conf_yn_2 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D13', $fax_conf_yn_2, $fax_conf_info_2, $insert_user);
if ($fax_conf_yn_3 == 'Y') {
$fax_conf_yn_3 = '10000';
} else {
$fax_conf_yn_3 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D14', $fax_conf_yn_3, $fax_conf_info_3, $insert_user);
$this->saveV2ChgHistory($vr_sq, '35', 'C9', $insert_id, '현장확인 매물');
$faxModel = new FaxModel();
$fax = $faxModel->selectFax($fax_sq); // fax 이미지 파일 가져오기
$receiptModel = new ReceiptModel();
$receipt = $receiptModel->selectReceiptOne($vr_sq); // 매물정보 가져오기
// 40: 촬영, 70: 검수지연... 상태가 촬용 이전 또는 검수지연 상태일 경우에만 홍보확인서를 등록한다.
if (substr($receipt['rcpt_stat'], 0, 2) <= '40' || substr($receipt['rcpt_stat'], 0, 2) == '70') {
$arrImagePath = array(
'/home/confirms/test-admin.confirms.co.kr/upload/',
'/home/confirms/upload/',
'/home/www/admin.confirms.co.kr/upload/',
'/home/www/upload/',
'/image/confirms_upload/',
'/misc/image/confirms_upload/',
'/storage/web/admin.confirms.co.kr/src/upload/',
'/storage/web/admin.confirms.co.kr/upload/',
$_SERVER['DOCUMENT_ROOT'] . '/upload/',
);
$image_path = str_replace($arrImagePath, '/upload/', $fax['file_path']);
$receiptModel->saveFaxImage($fax_sq, $receipt['rcpt_sq'], $receipt['rsrv_sq'], 'I1', $image_path, $fax['file_name'], '.jpg', $fax['img_size'], $fax['img_width'], $fax['img_height'], $receipt);
}
break;
case '2': // 일반확인매물
$article = $this->getArticleInfo2($atcl_no, $vr_sq);
$try_cnt = $article['try_cnt']; // 0 -> 1 차시도, 1 -> 2 차시도
$try_cnt = $try_cnt + 1;
//memo 저장
$res_memo = $this->saveMemo([$memo, $vr_sq]);
$stat_cd = "30"; // 전화/서류 확인 중
if ($result_d11 == '10000' && $fax_conf_yn_1 == 'Y' && $fax_conf_yn_2 == 'Y' && $fax_conf_yn_3 == 'Y') {
$success = TRUE; // 전화/서류 확인 성공
} else {
$success = FALSE; // 전화/서류 확인 실패
}
// 1. 매물정보 저장 fax_imgs
$r = $this->saveFaxImgs($fax_sq, $work_type, $article['vr_sq'], $article['atcl_no'], $article['cpid'], $article['realtor_nm'], $stat_cd, $current_tm, $article['address_code'], $article['address2'], 'Y');
// 2.1 확인결과 저장 v2_confirm
$fax = $this->getDetail($fax_sq);
$this->saveV2Confirm($vr_sq, 'D', $success, $try_cnt, $fax['charger'], $current_tm, $insert_user, $update_user, $work_type);
// 2.2 확인정보 체크 v2_check_list
// $fax_conf_yn_1, $fax_conf_yn_2, $fax_conf_yn_3,
// $fax_conf_info_1, $fax_conf_info_2, $fax_conf_info_3
if (is_array($comment_d11)) {
$comment = implode('|', $comment_d11);
} else {
$comment = $comment_d11;
}
$this->saveV2CheckList($vr_sq, 'D', 'D11', $result_d11, $comment, $insert_user);
if ($fax_conf_yn_1 == 'Y') {
$fax_conf_yn_1 = '10000';
} else {
$fax_conf_yn_1 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D12', $fax_conf_yn_1, $fax_conf_info_1, $insert_user);
if ($fax_conf_yn_2 == 'Y') {
$fax_conf_yn_2 = '10000';
} else {
$fax_conf_yn_2 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D13', $fax_conf_yn_2, $fax_conf_info_2, $insert_user);
if ($fax_conf_yn_3 == 'Y') {
$fax_conf_yn_3 = '10000';
} else {
$fax_conf_yn_3 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D14', $fax_conf_yn_3, $fax_conf_info_3, $insert_user);
if ($success == TRUE) {
$stat_cd = '35'; // 서류확인완료
$this->saveV2ChgStat($vr_sq, $stat_cd, $insert_user);
$rgbk_confirm = $this->getRgbk_confirm($vr_sq);
if (empty($rgbk_confirm)) {
// 등기부등본 확인이 불필요할 경우
$stat_cd = '60'; // 등기부등본 확인 중
$this->saveV2ChgStat($vr_sq, $stat_cd, $insert_user);
} else {
// 등기부등본 확인이 필요할 경우
$stat_cd = '40'; // 등기부등본 확인 중
$this->saveV2ChgStat($vr_sq, $stat_cd, $insert_user);
}
} else {
$stat_cd = '39'; // 서류확인 불일치
$this->saveV2ChgStat($vr_sq, $stat_cd, $insert_user);
}
// 3.1 검증요청 상태변경 v2_vrfc_req
$this->saveV2VrfcReq($vr_sq, $stat_cd);
// 4. 첨부파일 저장 v2_files
// fax_sq, mid, file_name, file_path, thumbnail, img_width, img_height, img_size, img_sq, remark, work_type, atcl_no, cpid, realtor_nm, stat_cd, proc_tm, send_tm, address_code, address2, charger
$pos = strpos($fax['file_name'], '.');
if ($pos === false) {
$file_ext = '';
} else {
$file_ext = substr($fax['file_name'], $pos);
}
$this->saveV2Files($vr_sq, $fax['file_path'], $fax['file_name'], $file_ext, $fax['img_size'], $fax['img_width'], $fax['img_height'], $insert_user);
// 5. 변경이력 저장 v2_chg_history
$memo = '';
$this->saveV2ChgHistory($vr_sq, $stat_cd, 'C9', $insert_id, $memo);
break;
default: // 오류
break;
}
}
public function saveHongBoFAX($fax_sq, $vr_sq, $atcl_no, $work_type, $send_yn, $result_d11, $comment_d11, $fax_conf_yn_1, $fax_conf_yn_2, $fax_conf_yn_3, $fax_conf_info_1, $fax_conf_info_2, $fax_conf_info_3, $file_type, $stat_cd = '')
{
// 1. 매물정보 저장 fax_imgs
// 2.1 확인결과 저장 v2_confirms
// 2.2 확인정보 체크 v2_check_list
// 3.1 검증요청 상태변경 v2_vrfc_req
// 3.2 상태변경 저장 v2_chg_stat
// 4. 첨부파일 저장 v2_files
// 5. 변경이력 저장 v2_chg_history
// 6. kiso 전송하기
$this->db->transStart();
$article = NULL;
$current_tm = date('Y-m-d H:i:s');
$insert_user = session('usr_sq');
$insert_id = session('usr_id');
$update_user = $insert_user;
$article = $this->getArticleInfo1($atcl_no, $vr_sq);
// 1. 매물정보 저장 fax_imgs
$this->saveFaxImgs($fax_sq, $work_type, $vr_sq, $atcl_no, $article['cpid'], $article['realtor_nm'], '35', $current_tm, $article['address_code'], $article['address2'], $send_yn);
// 2.1 확인결과 저장 v2_confirm
if ($result_d11 == '10000' && $fax_conf_yn_1 == 'Y' && $fax_conf_yn_2 == 'Y' && $fax_conf_yn_3 == 'Y') {
$success = TRUE;
} else {
$success = FALSE;
}
$fax = $this->getDetail($fax_sq);
$this->saveV2Confirm($vr_sq, 'D', $success, '1', $fax['charger'], $current_tm, $insert_user, $update_user, $work_type);
// 2.2 확인정보 체크 v2_check_list
// $fax_conf_yn_1, $fax_conf_yn_2, $fax_conf_yn_3,
// $fax_conf_info_1, $fax_conf_info_2, $fax_conf_info_3
if (is_array($comment_d11)) {
$comment = implode('|', $comment_d11);
} else {
$comment = $comment_d11;
}
$this->saveV2CheckList($vr_sq, 'D', 'D11', $result_d11, $comment, $insert_user);
if ($fax_conf_yn_1 == 'Y') {
$fax_conf_yn_1 = '10000';
} else {
$fax_conf_yn_1 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D12', $fax_conf_yn_1, $fax_conf_info_1, $insert_user);
if ($fax_conf_yn_2 == 'Y') {
$fax_conf_yn_2 = '10000';
} else {
$fax_conf_yn_2 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D13', $fax_conf_yn_2, $fax_conf_info_2, $insert_user);
if ($fax_conf_yn_3 == 'Y') {
$fax_conf_yn_3 = '10000';
} else {
$fax_conf_yn_3 = '20000';
}
$this->saveV2CheckList($vr_sq, 'D', 'D14', $fax_conf_yn_3, $fax_conf_info_3, $insert_user);
$this->saveV2ChgHistory($vr_sq, '35', 'C9', $insert_id, '현장확인 매물');
$faxModel = new FaxModel();
$fax = $faxModel->selectFax($fax_sq); // fax 이미지 파일 가져오기
$receiptModel = new ReceiptModel();
$receipt = $receiptModel->selectReceiptOne($vr_sq); // 매물정보 가져오기
// 40: 촬영, 70: 검수지연... 상태가 촬용 이전 또는 검수지연 상태일 경우에만 홍보확인서를 등록한다.
if (substr($receipt['rcpt_stat'], 0, 2) <= '40' || substr($receipt['rcpt_stat'], 0, 2) == '70') {
$arrImagePath = array(
'/home/confirms/test-admin.confirms.co.kr/upload/',
'/home/confirms/upload/',
'/home/www/admin.confirms.co.kr/upload/',
'/home/www/upload/',
'/image/confirms_upload/',
'/misc/image/confirms_upload/',
'/storage/web/admin.confirms.co.kr/src/upload/',
'/storage/web/admin.confirms.co.kr/upload/',
$_SERVER['DOCUMENT_ROOT'] . '/upload/',
);
$image_path = str_replace($arrImagePath, '/upload/', $fax['file_path']);
$receiptModel->saveFaxImage($fax_sq, $receipt['rcpt_sq'], $receipt['rsrv_sq'], $file_type, $image_path, $fax['file_name'], '.jpg', $fax['img_size'], $fax['img_width'], $fax['img_height'], $receipt);
}
$this->db->transComplete();
$return = array(
'code' => $this->db->_error_number(),
'message' => $this->db->_error_message(),
);
return $return;
}
/**
* 검증결과 저장하기
*/
public function saveV2Confirm($vr_sq, $vrfc_type, $success, $type, $charger, $date, $insert_user, $update_user, $work_type = '2')
{
$insert_user = session('usr_sq');
$insert_id = session('usr_id');
$update_user = $insert_user;
// DB에서 변경되지 전 값을 읽어온다.
$sql = "select success, type, charger, date from v2_confirm" .
" where vr_sq = ?" .
" and vrfc_type = ?";
$data = array(
$vr_sq,
$vrfc_type
);
$query = $this->db->query($sql, $data);
$data_table = array();
if ($query->getNumRows() > 0) {
$data_table = $query->getRowArray();
}
$date = str_replace(array(' ', '-', ':'), '', $date);
$sql = "INSERT INTO v2_confirm" .
" (vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type)" .
" VALUES" .
" (?, ?, ?, ?, ?, ?, ?, now(), ?, now(), ?)" .
" ON DUPLICATE KEY UPDATE" .
" success=values(success), type=values(type), charger=values(charger), date=values(date), update_user=values(update_user), update_tm=values(update_tm), work_type=values(work_type)";
$data = array(
'vr_sq' => $vr_sq,
'vrfc_type' => $vrfc_type,
'success' => $success,
'type' => $type,
'charger' => $charger,
'date' => $date,
'insert_user' => $insert_user,
'update_user' => $update_user,
'work_type' => $work_type
);
$this->db->query($sql, $data);
// 변경이력 저장하기
if (!empty($data_table)) {
$this->saveV2ChgHistory($vr_sq, '30', 'C27', $insert_id, "검증결과 정보 저장");
}
}
/**
* 확인정보 저장하기
*/
public function saveV2CheckList($vr_sq, $vrfc_type, $type, $code, $comment, $insert_user)
{
$insert_id = session('usr_id');
$sql = "select code, comment from v2_check_list" .
" where vr_sq = ?" .
" and type = ?";
$data = array(
$vr_sq,
$type
);
$query = $this->db->query($sql, $data);
$data_table = array();
if ($query->getNumRows() > 0) {
$data_table = $query->getRowArray();
}
$sql = "INSERT INTO v2_check_list" .
" (vr_sq, vrfc_type, type, code, comment, insert_user, insert_tm)" .
" VALUES" .
" (?, ?, ?, ?, ?, ?, now())" .
" ON DUPLICATE KEY UPDATE" .
" vr_sq=values(vr_sq), vrfc_type=values(vrfc_type), type=values(type), code=values(code), comment=values(comment), insert_user=values(insert_user), insert_tm=values(insert_tm)";
$data = array(
'vr_sq' => $vr_sq,
'vrfc_type' => $vrfc_type,
'type' => $type,
'code' => $code,
'comment' => $comment,
'insert_user' => $insert_user
);
$this->db->query($sql, $data);
// 변경이력 저장하기
if (!empty($data_table)) {
$this->saveV2ChgHistory($vr_sq, '30', 'C27', $insert_id, "확인정보 저장");
}
}
/**
* 상태변경시간 등록
*/
public function saveV2ChgStat($vr_sq, $stat_cd, $insert_user)
{
$sql = "INSERT INTO v2_chg_stat" .
" (vr_sq, stat_cd, insert_user, insert_tm)" .
" VALUES" .
" (?, ?, ?, now())" .
" ON DUPLICATE KEY UPDATE" .
" insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = array($vr_sq, $stat_cd, $insert_user);
$this->db->query($sql, $data);
log_message('debug', $this->db->getLastQuery());
}
/**
* 전송 후 FAX에 상태 및 전송시간을 저장한다.
*/
public function saveFaxImgsAfterSend($fax_sq, $vr_sq, $stat_cd, $send_tm = '')
{
if (empty($send_tm))
$send_tm = date('Y-m-d H:i:s');
$data_fax_imgs = [
'stat_cd' => $stat_cd,
'send_tm' => $send_tm,
];
$builder = $this->db->table('fax_imgs');
$builder->where('fax_sq', $fax_sq);
$builder->where('vr_sq', $vr_sq);
$builder->update($data_fax_imgs);
log_message('debug', $this->db->getLastQuery());
}
/**
* 검증요청 v2_vrfc_req의 상태 stat_cd를 업데이트한다.
*/
public function saveV2VrfcReq($vr_sq, $stat_cd)
{
$sql = "update v2_vrfc_req" .
" set stat_cd = ?" .
" where vr_sq = ?";
$data = array($stat_cd, $vr_sq);
$res = $this->db->query($sql, $data);
log_message('debug', $this->db->getLastQuery());
log_message('debug', $res);
}
/**
* 홍보확인서를 매물정보에 등록한다.
*/
public function saveV2Files($vr_sq, $file_path, $file_name, $file_ext, $file_size, $img_width, $img_height, $insert_user)
{
$arrImagePath = array(
'/home/confirms/test-admin.confirms.co.kr/upload/',
'/home/confirms/upload/',
'/home/www/admin.confirms.co.kr/upload/',
'/home/www/upload/',
'/image/confirms_upload/',
'/misc/image/confirms_upload/',
'/storage/web/admin.confirms.co.kr/src/upload/',
'/storage/web/admin.confirms.co.kr/upload/',
$_SERVER['DOCUMENT_ROOT'] . '/upload/',
);
$file_path = str_replace($arrImagePath, '/upload/', $file_path);
$file_type = '1'; // 홍보확인서
// 1. 홍보확이서 등록여부 확인
$sql = "SELECT count(*) file_cnt FROM v2_files" .
" WHERE vr_sq = ?" .
" AND file_type = ?" .
" AND file_path = ?" .
" AND file_name = ?" .
" AND use_yn = 'Y'";
$data = array(
$vr_sq,
$file_type,
$file_path,
$file_name
);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
if (empty($row['file_cnt'])) {
// 2. 다른파일로 등록된 경우를 위해서 업데이트
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = ? AND file_type = ?";
$data = array($vr_sq, $file_type);
$this->db->query($sql, $data);
// 3. 등록
$sql = "INSERT INTO v2_files " .
" (vr_sq, use_yn, file_type, view_odr, file_path, file_name, file_ext, file_size, img_width, img_height, insert_user, insert_tm)" .
" VALUES" .
" (?, 'Y', ?, '1', ?, ?, ?, ?, ?, ?, ?, NOW())";
$data = array($vr_sq, $file_type, $file_path, $file_name, $file_ext, $file_size, $img_width, $img_height, $insert_user);
$this->db->query($sql, $data);
}
}
/**
* 검증결과 전송 API를 위한 데이터 조회..
*/
public function getDataConfirmAPI($vr_sq)
{
// 요청정보
$sql = "SELECT vr_sq, atcl_no, step, cpid, cp_atcl_id, trade_type, realtor_nm, realtor_tel_no, seller_tel_no, vrfc_type, rgbk_confirm, req_type, rdate, stat_cd, try_cnt, insert_user, insert_tm" .
" FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_vrfc_req = $query->getRowArray();
// 매물정보
$sql = "SELECT vr_sq, atcl_no, cpid, cp_atcl_id, rlet_type_cd, trade_type, address_code, address1, address2, address3, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sise, floor, rdate, seller_tel_no, seller_nm, realtor_nm, realtor_tel_no, hscp_no, hscp_nm, ptp_no, ptp_nm, charger, req_price_yn, reg_charger, dept1_sq, dept2_sq, reg_dept1_sq, reg_dept2_sq, floor2" .
" FROM v2_article_info WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$query->getRowArray();
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, address4, trade_type, deal_amt, wrrnt_amt, lease_amt, isale_amt, prem_amt, sply_spc, excls_spc, tot_spc, grnd_spc, bldg_spc, hscp_no, hscp_nm, ptp_no, ptp_nm, modify_yn, floor2 FROM v2_modify_info WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_modify_info = $query->getRowArray();
// 검증결과
$sql = "SELECT vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm, work_type" .
" FROM v2_confirm WHERE vr_sq = ? AND vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$row_confirm = $query->getRowArray();
// 확인정보
$sql = "SELECT type, code, comment, ownerNm, ownerBirth FROM v2_check_list WHERE vr_sq = ? AND vrfc_type = ? AND type LIKE CONCAT(vrfc_type, '%')";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$res_check_list = $query->getResultArray();
$atclNo = $row_vrfc_req['atcl_no'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'];
$date = $row_confirm['date'];
$try_cnt = $row_vrfc_req['try_cnt'];
$checkList = [];
foreach ($res_check_list as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['ownerBirth'],
];
}
$modifyInfo = [];
if ($row_modify_info['modify_yn'] == 'Y') {
if (!empty($row_modify_info['hscp_no'])) {
// 공동주택
$modifyInfo = [
'hscpNo' => $row_modify_info['hscp_no'],
'ptpNo' => $row_modify_info['ptp_no'],
'bildNm' => $row_modify_info['address2'],
'rmNo' => $row_modify_info['address3'],
'tradeType' => $row_modify_info['trade_type'],
'dealAmt' => $row_modify_info['deal_amt'],
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
'leaseAmt' => $row_modify_info['lease_amt'],
'isaleAmt' => $row_modify_info['isale_amt'],
'premAmt' => $row_modify_info['prem_amt'],
'floor' => $row_modify_info['floor'],
];
} else {
// 비공동주택
$modifyInfo = [
'addressCode' => $row_modify_info['address_code'],
'address2' => $row_modify_info['address2'],
'address3' => $row_modify_info['address3'],
'tradeType' => $row_modify_info['trade_type'],
'dealAmt' => $row_modify_info['deal_amt'],
'wrrntAmt' => $row_modify_info['wrrnt_amt'],
'leaseAmt' => $row_modify_info['lease_amt'],
'splySpc' => $row_modify_info['sply_spc'],
'exclsSpc' => $row_modify_info['excls_spc'],
'totSpc' => $row_modify_info['tot_spc'],
'grndSpc' => $row_modify_info['grnd_spc'],
'bldgSpc' => $row_modify_info['bldg_spc'],
'floor' => $row_modify_info['floor'],
'floor2' => $row_modify_info['floor2'],
];
}
return [
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'try_cnt' => $try_cnt,
];
}
return [
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'try_cnt' => $try_cnt,
];
}
/**
* 담당자를 지정해준다.
*/
public function InsCharger($vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$vr_sq
);
$this->db->query($sql, $data);
}
/**
* 상태를 변경한다.
*/
public function saveChangeStep($fax_sq, $vr_sq, $stat_cd)
{
$insert_user = session('usr_sq');
$insert_id = session('usr_id');
$this->db->transStart();
// 1. 검증요청 상태변경 v2_vrfc_req
$this->saveV2VrfcReq($vr_sq, $stat_cd);
// 2. 상태변경 저장 v2_chg_stat
$this->saveV2ChgStat($vr_sq, $stat_cd, $insert_user);
// 3. 변경이력 저장 v2_chg_history
$this->saveV2ChgHistory($vr_sq, $stat_cd, 'C9', $insert_id, "");
// 4. FAX에 최종 저장시 상태값 저장
$this->saveFaxImgsAfterSend($fax_sq, $vr_sq, $stat_cd, $send_tm = '');
$this->db->transComplete();
$return = array(
'code' => $this->db->_error_number(),
'message' => $this->db->_error_message(),
);
return $return;
}
/**
* 값을 실패횟수 값을 증가시킨다.
*/
public function increseTryCnt($vr_sq)
{
$sql = "update v2_vrfc_req set try_cnt = ifnull(try_cnt,0) +1 where vr_sq = ?";
$data = array($vr_sq);
$this->db->query($sql, $data);
}
public function getI8Cnt($rsrv_sq)
{
$sql = "SELECT COUNT(img_sq) cnt" .
" FROM result_imgs" .
" WHERE rsrv_sq = ?" .
" AND img_type = 'I8'" .
" AND use_yn = 'Y'";
$data = array($rsrv_sq);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function get_rsrv_sq($rcpt_sq)
{
$sql = "SELECT rsrv_sq " .
" FROM result" .
" WHERE rcpt_sq = ?";
$data = array($rcpt_sq);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
// 메모저장
public function saveMemo($data)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_vrfc_req SET
memo = ?
WHERE vr_sq = ?";
if ($this->db->query($sql, $data) === false) {
return [
'success' => false,
'msg' => '파일정보 저장 실패',
];
}
$row = $this->getDetail($data[1]);
$memo = "메모변경 : " . $row['memo'] . " => " . $data[0];
$this->saveChangedHistory($data[1], $row['pre_stat_cd'], 'C19', $usr_id, $memo);
return [
'success' => true
];
}
/**
* 변경이력 저장하기
*/
public function saveV2ChgHistory($vr_sq, $stat_cd, $chg_type, $insert_id, $memo)
{
$sql = "INSERT INTO v2_chg_history" .
" (vr_sq, stat_cd, chg_type, insert_id, insert_tm, memo)" .
" VALUES" .
" (?, ?, ?, ?, now(), ?)";
$data = array($vr_sq, $stat_cd, $chg_type, $insert_id, $memo);
$this->db->query($sql, $data);
log_message('debug', $this->db->getLastQuery());
}
// 변경내용 저장
public function saveChangedHistory($rcpt_sq, $rcpt_stat, $changed_type, $usr_id, $remark)