This commit is contained in:
@@ -185,6 +185,15 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
|
|||||||
*/
|
*/
|
||||||
$routes->get('m708a/getResultList', 'M708::getResultList');
|
$routes->get('m708a/getResultList', 'M708::getResultList');
|
||||||
$routes->get('m708a/excel', 'M708::excel');
|
$routes->get('m708a/excel', 'M708::excel');
|
||||||
|
$routes->get('m708a/getArticleInfo', 'M708::getArticleInfo'); // 매물검색
|
||||||
|
$routes->post('m708a/saveNotArticle', 'M708::saveNotArticle'); // 홍보확인서 아님 저장
|
||||||
|
$routes->post('m708a/saveDuplImgs', 'M708::saveDuplImgs'); // 중복으로 저장
|
||||||
|
$routes->post('m708a/saveMobileBunyang', 'M708::saveMobileBunyang'); // 모바일분양권 저장
|
||||||
|
$routes->post('m708a/saveBunyang', 'M708::saveBunyang'); // 분양권 저장
|
||||||
|
$routes->post('m708a/saveRequestMessage', 'M708::saveRequestMessage'); // 중개인 요청사항 저장
|
||||||
|
$routes->post('m708a/saveResult', 'M708::saveResult'); // 결과저장
|
||||||
|
$routes->post('m708a/saveBunyangCnt', 'M708::saveBunyangCnt'); // 분양계약서저장
|
||||||
|
$routes->post('m708a/getNextFaxImgs', 'M708::getNextFaxImgs'); // 다음매물
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -341,7 +341,6 @@ class M703 extends BaseController
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
|
||||||
$rcpt_sq = $this->request->getPost('vr_sq');
|
$rcpt_sq = $this->request->getPost('vr_sq');
|
||||||
$atcl_no = $this->request->getPost('atcl_no');
|
$atcl_no = $this->request->getPost('atcl_no');
|
||||||
$fax_sq = $this->request->getPost('fax_sq'); // FAX 순번
|
$fax_sq = $this->request->getPost('fax_sq'); // FAX 순번
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
namespace App\Controllers\V2;
|
namespace App\Controllers\V2;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
|
use App\Libraries\Common;
|
||||||
use App\Models\common\CodeModel;
|
use App\Models\common\CodeModel;
|
||||||
use App\Models\v2\M708Model;
|
use App\Models\v2\M708Model;
|
||||||
|
|
||||||
@@ -112,4 +113,346 @@ class M708 extends BaseController
|
|||||||
$e->getPrevious()->getTraceAsString();
|
$e->getPrevious()->getTraceAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 상세화면
|
||||||
|
public function detail($id)
|
||||||
|
{
|
||||||
|
$id = (int) $id;
|
||||||
|
|
||||||
|
if ($id <= 0) {
|
||||||
|
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
|
||||||
|
}
|
||||||
|
|
||||||
|
$codes = $this->codeModel->getCodeLists(['CONFIRM_RESULT_D11', 'CONSULTANT_COMMENT']); // 코드조회
|
||||||
|
|
||||||
|
$data = $this->model->getDetail($id);
|
||||||
|
$memo = $this->model->getMemo($id);
|
||||||
|
|
||||||
|
|
||||||
|
$article = null;
|
||||||
|
$confirm = null;
|
||||||
|
if (!empty($data)) {
|
||||||
|
switch ($data['work_type']) {
|
||||||
|
case "1": // 현장확인 매물
|
||||||
|
$article = $this->model->getArticleInfo1($data['atcl_no']);
|
||||||
|
$article['stat_cd'] = $data['stat_cd'];
|
||||||
|
$confirm = $this->model->getV2Confirm($data['vr_sq'], $data['work_type']);
|
||||||
|
break;
|
||||||
|
case "2": // 일반확인 매물
|
||||||
|
$article = $this->model->getArticleInfo2($data['atcl_no']);
|
||||||
|
$confirm = $this->model->getV2Confirm($data['vr_sq']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->data['article'] = $article;
|
||||||
|
$this->data['confirm'] = $confirm;
|
||||||
|
}
|
||||||
|
|
||||||
|
$history = $this->model->getHistory($data['vr_sq']);
|
||||||
|
|
||||||
|
$this->data['codes'] = $codes;
|
||||||
|
$this->data['data'] = $data;
|
||||||
|
$this->data['memo'] = $memo;
|
||||||
|
$this->data['history'] = $history;
|
||||||
|
|
||||||
|
|
||||||
|
return view("pages/v2/m708/detail", $this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 이미지회전
|
||||||
|
public function rotateImage()
|
||||||
|
{
|
||||||
|
$common = new Common();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
$vr_sq = $this->request->getPost('vr_sq');
|
||||||
|
$degress = $this->request->getPost('degress');
|
||||||
|
|
||||||
|
if (empty($degrees) || !is_numeric($degrees)) {
|
||||||
|
$degrees = 90;
|
||||||
|
}
|
||||||
|
|
||||||
|
$regist = $this->model->getRecordInfo($vr_sq, '2');
|
||||||
|
$fullPath = $regist['file_path'] . $regist['file_name'];
|
||||||
|
$fullPath = $_SERVER['DOCUMENT_ROOT'] . $common->realpath_to_webpath($fullPath);
|
||||||
|
|
||||||
|
$degrees = (float) $degrees;
|
||||||
|
|
||||||
|
$im = new \Imagick($fullPath);
|
||||||
|
|
||||||
|
// 배경색(회전 시 빈 공간 채우는 색). 투명 원하면 'transparent'
|
||||||
|
$im->setImageBackgroundColor(new \ImagickPixel('white'));
|
||||||
|
|
||||||
|
// 회전
|
||||||
|
$im->rotateImage($im->getImageBackgroundColor(), $degrees);
|
||||||
|
|
||||||
|
// 포맷/압축 유지(옵션)
|
||||||
|
$im->setImageCompressionQuality(90);
|
||||||
|
|
||||||
|
// 덮어쓰기
|
||||||
|
$im->writeImage($fullPath);
|
||||||
|
|
||||||
|
$im->clear();
|
||||||
|
$im->destroy();
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 매물검색
|
||||||
|
public function getArticleInfo()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$atcl_no = $this->request->getGet('atcl_no');
|
||||||
|
|
||||||
|
$row = $this->model->getArticleInfo($atcl_no);
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($row)) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => '매물이 존재하지 않습니다.',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
'atcl_no' => $row['vr_sq'],
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 홍보확인서 아님 저장
|
||||||
|
public function saveNotArticle()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq');
|
||||||
|
|
||||||
|
$this->model->saveNotArticle($fax_sq);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 중복으로 저장
|
||||||
|
public function saveDuplImgs()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq');
|
||||||
|
$atcl_no = $this->request->getPost('atcl_no');
|
||||||
|
$vr_sq = $this->request->getPost('vr_sq');
|
||||||
|
|
||||||
|
$this->model->saveDuplImgs($fax_sq, $atcl_no, $vr_sq);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 모바일 분양권 저장
|
||||||
|
public function saveMobileBunyang()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq');
|
||||||
|
$atcl_no = $this->request->getPost('atcl_no');
|
||||||
|
$vr_sq = $this->request->getPost('vr_sq');
|
||||||
|
|
||||||
|
$this->model->saveMobileBunyang($fax_sq, $atcl_no, $vr_sq);
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 분양권 저장
|
||||||
|
public function saveBunyang()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq');
|
||||||
|
|
||||||
|
$this->model->saveBunyang($fax_sq);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 중개인 요청사항 저장
|
||||||
|
public function saveRequestMessage()
|
||||||
|
{
|
||||||
|
$rcpt_sq = $this->request->getPost('vr_sq');
|
||||||
|
$atcl_no = $this->request->getPost('atcl_no');
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq'); // FAX 순번
|
||||||
|
$msg = $this->request->getPost('msg');
|
||||||
|
|
||||||
|
$rsrv_sq = $this->request->getPost('rsrv_sq');
|
||||||
|
|
||||||
|
// UPDATE result
|
||||||
|
$this->model->saveRequestMessage($rcpt_sq, $rsrv_sq, $msg);
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 확인결과 저장
|
||||||
|
public function saveResult()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$fax_sq = $this->request->getPost('fax_sq');
|
||||||
|
$vr_sq = $this->request->getPost('vr_sq');
|
||||||
|
$atcl_no = $this->request->getPost('atcl_no');
|
||||||
|
$work_type = $this->request->getPost('work_type');
|
||||||
|
$file_type = $this->request->getPost('file_type');
|
||||||
|
|
||||||
|
$resyn = $this->request->getPost('resYn');
|
||||||
|
$dbusageagryn = $this->request->getPost('dbUsageAgrYn');
|
||||||
|
$send_yn = 'Y';
|
||||||
|
|
||||||
|
$article = $this->model->getArticleInfo2($atcl_no, $vr_sq);
|
||||||
|
$v2_vrfc_req = $this->model->get_v2_vrfc_req($vr_sq);
|
||||||
|
|
||||||
|
if (intval($article['stat_cd']) >= 40) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => '이미 저장된 데이터입니다.',
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 거주여부 & DB활용동의여부 수정 UPDATE
|
||||||
|
if (!empty($resyn)) {
|
||||||
|
$this->model->updateResDb($resyn, $dbusageagryn, $vr_sq);
|
||||||
|
}
|
||||||
|
|
||||||
|
// DB에 결과 저장
|
||||||
|
// $this->model->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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 분양계약서 저장
|
||||||
|
public function saveBunyangCnt()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$vr_sq = $this->request->getPost('vr_sq');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 다음 매물정보 조회
|
||||||
|
public function getNextFaxImgs()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
|
||||||
|
$curr_fax_sq = $this->request->getPost('curr_fax_sq');
|
||||||
|
|
||||||
|
$data = $this->model->getNextFaxImgs($curr_fax_sq);
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => 'FAX 이미지가 존재하지 않습니다.'
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '0',
|
||||||
|
'msg' => 'success',
|
||||||
|
'data' => $data
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return $this->response->setJSON([
|
||||||
|
'code' => '9',
|
||||||
|
'msg' => $e->getMessage(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -692,4 +692,543 @@ class M708Model extends Model
|
|||||||
|
|
||||||
return $query->getResultArray();
|
return $query->getResultArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 상세정보
|
||||||
|
public function getDetail($fax_sq)
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->db->transStart();
|
||||||
|
|
||||||
|
$usr_id = session('usr_id');
|
||||||
|
$usr_sq = session('usr_sq');
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
a.fax_sq, a.mid, a.file_name, a.file_path, a.thumbnail, a.img_width, a.img_height, a.img_size, a.img_sq, a.remark,
|
||||||
|
a.work_type, a.vr_sq, a.atcl_no, a.cpid, a.realtor_nm, a.stat_cd, a.proc_tm, a.send_tm, a.address_code, a.address2,
|
||||||
|
a.address2a, a.address2b, a.charger, a.caller_no
|
||||||
|
FROM
|
||||||
|
fax_imgs a
|
||||||
|
WHERE
|
||||||
|
a.fax_sq = " . $fax_sq;
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
|
||||||
|
if (!empty($row)) {
|
||||||
|
$row_dept = $this->getDepartmentPath($usr_sq);
|
||||||
|
$dept1_sq = '';
|
||||||
|
$dept2_sq = '';
|
||||||
|
if (!empty($row_dept)) {
|
||||||
|
$dept1_sq = $row_dept['dept1_sq'];
|
||||||
|
$dept2_sq = $row_dept['dept2_sq'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// $sql = "UPDATE fax_imgs SET stat_cd = '20', charger = '{$usr_id}', dept1_sq = '{$dept1_sq}', dept2_sq = '{$dept2_sq}'
|
||||||
|
// WHERE fax_sq = {$fax_sq}
|
||||||
|
// ";
|
||||||
|
|
||||||
|
// $this->db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->transComplete();
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 사용자 부서 조회
|
||||||
|
public function getDepartmentPath($usr_sq)
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
b.dept_sq AS dept2_sq, c.dept_sq AS dept1_sq
|
||||||
|
FROM users a
|
||||||
|
JOIN departments b ON b.dept_sq = a.dept_sq
|
||||||
|
JOIN departments c ON c.dept_sq = b.pdept_sq
|
||||||
|
WHERE a.usr_sq = ?";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$usr_sq]);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 현장확인매물 조회
|
||||||
|
public function getArticleInfo1($atcl_no, $vr_sq = '')
|
||||||
|
{
|
||||||
|
$sql_where = "";
|
||||||
|
if (!empty($vr_sq)) {
|
||||||
|
$sql_where = " and a.rcpt_sq = '" . $vr_sq . "'";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "select a.rcpt_sq vr_sq, a.rcpt_atclno atcl_no, a.rcpt_floor as floor, a.rcpt_floor2 as floor2, a.rcpt_cpid cpid, a.agent_nm realtor_nm, a.agent_head_tel agent_tel, a.agent_fax agent_fax, a.agent_contact_tel realtor_tel_no, a.rcpt_tm rdate, '' seller_nm, '' seller_tel_no, a.rcpt_product rlet_type_cd, a.rcpt_dong address_code, c.region_nm address1 , a.rcpt_dtl_addr address2, a.rcpt_li_addr address2a, a.rcpt_jibun_addr address2b, a.rcpt_etc_addr, a.rcpt_ho address3 , a.rcpt_ref_addr address4, a.rcpt_hscp_nm as hscp_nm, a.rcpt_ptp_nm as ptp_nm, a.trade_type" .
|
||||||
|
", case substr(a.trade_type, 1, 1) when 'A' then SUBSTRING_INDEX(a.rcpt_product_info2, '/', 1) else 0 end deal_amt" .
|
||||||
|
", case substr(a.trade_type, 1, 1) when 'B' then SUBSTRING_INDEX(a.rcpt_product_info2, '/', 1) else 0 end wrrnt_amt" .
|
||||||
|
", case substr(a.trade_type, 1, 1) when 'B' then case when a.rcpt_product_info3 is null || a.rcpt_product_info3 = '' || a.rcpt_product_info3 = '0' then SUBSTRING_INDEX(a.rcpt_product_info2, '/', -1) else a.rcpt_product_info3 end else 0 end lease_amt" .
|
||||||
|
", a.rcpt_product_info4 isale_amt, a.rcpt_product_info5 prem_amt, a.rcpt_product_nm rlet_type_nm, d.cd_nm trade_type_nm, b.dbUsageAgrYn, b.resYn ,'1' try_cnt, '10' stat_cd" .
|
||||||
|
", b.request_msg" .
|
||||||
|
", (SELECT cd_nm FROM codes WHERE category = 'RECEIPT_STATUS3' AND cd = a.rcpt_stat) AS current_stat" .
|
||||||
|
", case when a.isSiteVRVerification = 'Y' then '현장v2' else '현장' end as typeOfProperty" .
|
||||||
|
", a.rcpt_hscp_no as hscp_no " .
|
||||||
|
" from receipt a" .
|
||||||
|
" inner join result b on b.rcpt_sq = a.rcpt_sq" .
|
||||||
|
" left join region_codes c on c.region_cd = a.rcpt_dong" .
|
||||||
|
" left join codes d on d.category = 'TRADE_TYPE' AND d.cd = a.trade_type" .
|
||||||
|
" where a.rcpt_atclno = ? " . $sql_where .
|
||||||
|
"order by a.rcpt_sq desc, b.rsrv_sq desc";
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
$atcl_no
|
||||||
|
];
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, $data);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일반확인매물 조회
|
||||||
|
public function getArticleInfo2($atcl_no, $vr_sq = '')
|
||||||
|
{
|
||||||
|
$sql_where = "";
|
||||||
|
if (!empty($vr_sq)) {
|
||||||
|
$sql_where = " and a.vr_sq = ? ";
|
||||||
|
$data = array(
|
||||||
|
$vr_sq
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$sql_where = " and a.atcl_no = ? ";
|
||||||
|
$data = array(
|
||||||
|
$atcl_no
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// b.address1 대신에 region_nm 을 사용했음....
|
||||||
|
$sql = "select a.memo, g.cd_nm as pre_stat, a.vr_sq, a.atcl_no, a.cpid, a.realtor_nm, a.realtor_tel_no, b.floor, b.floor2, b.rdate, b.seller_nm, b.seller_tel_no agent_tel, b.rlet_type_cd, b.address_code, f.bild_nm as address1, f.address2, j.address2a, j.address2b, f.address3, f.address4, f.hscp_nm, f.ptp_nm, b.trade_type, f.deal_amt, f.wrrnt_amt, f.lease_amt, f.isale_amt, f.prem_amt, c.cd_nm as rlet_type_nm, d.cd_nm as trade_type_nm, a.try_cnt, a.stat_cd, '' request_msg, b.vrfc_type_sub, i.cd_nm as vrfc_type_sub_nm, b.confirm_doc_owner_check_yn, b.ownerNm, j.vir_addr_yn" .
|
||||||
|
", (SELECT cd_nm FROM codes WHERE category = 'STEP_VERIFICATION' AND cd = a.stat_cd) AS current_stat, a.vrfc_type, h.cd_nm AS vrfc_type_nm" .
|
||||||
|
", get_code_name('VRFCREQ_WAY',a.vrfc_type) as typeOfProperty " .
|
||||||
|
", b.hscp_no as hscp_no " .
|
||||||
|
" from v2_vrfc_req a" .
|
||||||
|
" inner join v2_article_info b on b.vr_sq = a.vr_sq and b.rdate >= date_add( now(), interval -3 month)" .
|
||||||
|
" inner join v2_article_info_etc j on j.vr_sq = a.vr_sq " .
|
||||||
|
" left join codes c on c.category = 'ARTICLE_TYPE' AND c.cd = b.rlet_type_cd" .
|
||||||
|
" left join codes d on d.category = 'VRFCREQ_DEAL_TYPE' AND d.cd = b.trade_type" .
|
||||||
|
" left join codes i on i.category like 'VRFC_TYPE_SUB_%' AND i.cd = b.vrfc_type_sub" .
|
||||||
|
" left join codes g on g.category = 'STEP_VERIFICATION' AND g.cd = a.stat_cd" .
|
||||||
|
" left join codes h on h.category = 'VRFCREQ_WAY' AND h.cd = a.vrfc_type" .
|
||||||
|
" left join region_codes e on e.region_cd = b.address_code" .
|
||||||
|
" left join v2_modify_info f on f.vr_sq = a.vr_sq" .
|
||||||
|
" where 1=1" . $sql_where .
|
||||||
|
" AND a.vrfc_type in('D','M')" .
|
||||||
|
" order by a.vr_sq desc" .
|
||||||
|
" limit 1";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, $data);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 홍보확인서 확인결과 읽어오기
|
||||||
|
public function getV2Confirm($vr_sq, $work_type = '2')
|
||||||
|
{
|
||||||
|
$sql = "SELECT b.type type_d11, b.code code_d11, b.comment comment_d11, c.type type_d12, c.code code_d12, c.comment comment_d12, d.type type_d13, d.code code_d13, d.comment comment_d13, e.type type_d14, e.code code_d14, e.comment comment_d14" .
|
||||||
|
" FROM v2_confirm a" .
|
||||||
|
" INNER JOIN v2_check_list b ON b.vr_sq = a.vr_sq AND b.type = 'D11'" .
|
||||||
|
" INNER JOIN v2_check_list c ON c.vr_sq = a.vr_sq AND c.type = 'D12'" .
|
||||||
|
" INNER JOIN v2_check_list d ON d.vr_sq = a.vr_sq AND d.type = 'D13'" .
|
||||||
|
" INNER JOIN v2_check_list e ON e.vr_sq = a.vr_sq AND e.type = 'D14'" .
|
||||||
|
" WHERE a.vr_sq = ?" .
|
||||||
|
" AND a.vrfc_type = 'D'" .
|
||||||
|
" AND a.work_type = ?";
|
||||||
|
$data = array($vr_sq, $work_type);
|
||||||
|
$query = $this->db->query($sql, $data);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 메모확인
|
||||||
|
public function getMemo($vr_sq)
|
||||||
|
{
|
||||||
|
$sql = "SELECT memo FROM v2_vrfc_req where vr_sq = ?";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$vr_sq]);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 변경이력 조회
|
||||||
|
public function getHistory($id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
a.seq,
|
||||||
|
a.rcpt_sq vr_sq,
|
||||||
|
a.rcpt_stat stat_cd,
|
||||||
|
a.changed_type chg_type,
|
||||||
|
a.changed_id insert_id,
|
||||||
|
a.changed_tm insert_tm,
|
||||||
|
a.remark memo,
|
||||||
|
b.cd_nm as stat_cd_nm,
|
||||||
|
c.cd_nm as chg_type
|
||||||
|
FROM
|
||||||
|
changed_history a
|
||||||
|
LEFT JOIN codes b ON a.rcpt_stat = b.cd AND b.category = 'RECEIPT_STATUS3'
|
||||||
|
LEFT JOIN codes c ON a.changed_type = c.cd AND c.category = 'CHANGED_TYPE'
|
||||||
|
WHERE
|
||||||
|
a.rcpt_sq = ?
|
||||||
|
ORDER BY a.seq DESC ";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$id]);
|
||||||
|
|
||||||
|
return $query->getResultArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getRecordInfo($vr_sq, $file_type)
|
||||||
|
{
|
||||||
|
$sql = "SELECT seq, vr_sq, use_yn, file_type, view_odr, file_path, file_name, file_ext, file_size, img_width, img_height, meta_data, insert_user, insert_tm , cloud_upload_yn " .
|
||||||
|
" FROM v2_files" .
|
||||||
|
" WHERE vr_sq = ?" .
|
||||||
|
" AND use_yn = 'Y'" .
|
||||||
|
" AND file_type = ?" .
|
||||||
|
" ORDER BY seq DESC";
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
$vr_sq,
|
||||||
|
$file_type
|
||||||
|
];
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$vr_sq, $file_type]);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 매물검색
|
||||||
|
public function getArticleInfo($atcl_no)
|
||||||
|
{
|
||||||
|
$sql = "SELECT
|
||||||
|
a.fax_sq, a.mid, a.file_name, a.file_path, a.thumbnail, a.img_width, a.img_height, a.img_size, a.img_sq, a.remark,
|
||||||
|
a.work_type, a.vr_sq, a.atcl_no, a.cpid, a.realtor_nm, a.stat_cd, a.proc_tm, a.send_tm, a.address_code, a.address2,
|
||||||
|
a.address2a, a.address2b, a.charger, a.caller_no
|
||||||
|
FROM
|
||||||
|
fax_imgs a
|
||||||
|
WHERE
|
||||||
|
a.atcl_no = " . $atcl_no;
|
||||||
|
|
||||||
|
$query = $this->db->query($sql);
|
||||||
|
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 홍보확인서 아님 저장
|
||||||
|
public function saveNotArticle($fax_sq)
|
||||||
|
{
|
||||||
|
$usr_id = session('usr_id');
|
||||||
|
$usr_sq = session('usr_sq');
|
||||||
|
|
||||||
|
$row_dept = $this->getDepartmentPath($usr_sq);
|
||||||
|
$dept1_sq = '';
|
||||||
|
$dept2_sq = '';
|
||||||
|
if (!empty($row_dept)) {
|
||||||
|
$dept1_sq = $row_dept['dept1_sq'];
|
||||||
|
$dept2_sq = $row_dept['dept2_sq'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "UPDATE fax_imgs SET
|
||||||
|
work_type = 'E', proc_tm = NOW(), stat_cd = '69', charger = ?, dept1_sq = ?, dept2_sq = ? WHERE fax_sq = ?
|
||||||
|
";
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
$usr_id,
|
||||||
|
$dept1_sq,
|
||||||
|
$dept2_sq,
|
||||||
|
$fax_sq
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($this->db->query($sql, $data) === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'msg' => '저장 실패',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 중복으로 저장
|
||||||
|
public function saveDuplImgs($fax_sq, $atcl_no, $vr_sq)
|
||||||
|
{
|
||||||
|
$current_tm = date('Y-m-d H:i:s');
|
||||||
|
$article = $this->getArticleInfo2($atcl_no, $vr_sq);
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 모바일 분양권 저장
|
||||||
|
public function saveMobileBunyang($fax_sq, $atcl_no, $vr_sq)
|
||||||
|
{
|
||||||
|
$this->db->transStart();
|
||||||
|
|
||||||
|
$cpid = "";
|
||||||
|
$realtor_nm = "";
|
||||||
|
$address_code = "";
|
||||||
|
$address2 = "";
|
||||||
|
|
||||||
|
$article = NULL;
|
||||||
|
$current_tm = date('Y-m-d H:i:s');
|
||||||
|
$insert_id = session('usr_id');
|
||||||
|
|
||||||
|
$article = $this->getArticleInfo2($atcl_no, $vr_sq);
|
||||||
|
|
||||||
|
if (!empty($article)) {
|
||||||
|
$cpid = $article['cpid'];
|
||||||
|
$realtor_nm = $article['realtor_nm'];
|
||||||
|
$address_code = $article['address_code'];
|
||||||
|
$address2 = $article['address2'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data_fax_imgs = [
|
||||||
|
'work_type' => '2',
|
||||||
|
'vr_sq' => $vr_sq,
|
||||||
|
'atcl_no' => $atcl_no,
|
||||||
|
'cpid' => $cpid,
|
||||||
|
'realtor_nm' => $realtor_nm,
|
||||||
|
'proc_tm' => $current_tm,
|
||||||
|
'address_code' => $address_code,
|
||||||
|
'address2' => $address2,
|
||||||
|
'charger' => $insert_id,
|
||||||
|
'mobile_yn' => 'Y'
|
||||||
|
];
|
||||||
|
|
||||||
|
$builder = $this->db->table('fax_imgs')->where('fax_sq', $fax_sq);
|
||||||
|
$ok = $builder->update($data_fax_imgs);
|
||||||
|
|
||||||
|
$data = [
|
||||||
|
$fax_sq,
|
||||||
|
$vr_sq,
|
||||||
|
$atcl_no,
|
||||||
|
$fax_sq
|
||||||
|
];
|
||||||
|
|
||||||
|
$sql = "INSERT INTO fax_imgs_mobile (fax_sq, vr_sq, atcl_no, recv_time)
|
||||||
|
VALUES
|
||||||
|
(?, ?, ?, (SELECT recv_time FROM fax_imgs WHERE fax_sq = ?))
|
||||||
|
ON DUPLICATE KEY UPDATE vr_sq = VALUES(vr_sq), atcl_no= VALUES(atcl_no), recv_time = VALUES(recv_time)
|
||||||
|
";
|
||||||
|
|
||||||
|
if ($this->db->query($sql, $data) === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'msg' => '저장 실패',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->transComplete();
|
||||||
|
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 분양권 저장
|
||||||
|
public function saveBunyang($fax_sq)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE fax_imgs SET
|
||||||
|
bunyang_yn = 'Y'
|
||||||
|
WHERE fax_sq = ?";
|
||||||
|
|
||||||
|
if ($this->db->query($sql, [$fax_sq]) === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'msg' => '저장 실패',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function saveFaxImgs($fax_sq, $work_type, $vr_sq, $atcl_no, $cpid, $realtor_nm, $stat_cd, $proc_tm, $address_code, $address2, $send_yn)
|
||||||
|
{
|
||||||
|
$insert_id = session('usr_id');
|
||||||
|
$usr_sq = session('usr_sq');
|
||||||
|
|
||||||
|
// 부서 정보
|
||||||
|
$row_dept = $this->getDepartmentPath($usr_sq);
|
||||||
|
|
||||||
|
$dept1_sq = $row_dept['dept1_sq'] ?? '';
|
||||||
|
$dept2_sq = $row_dept['dept2_sq'] ?? '';
|
||||||
|
|
||||||
|
// 업데이트 데이터
|
||||||
|
$dataFaxImgs = [
|
||||||
|
'work_type' => $work_type,
|
||||||
|
'vr_sq' => $vr_sq,
|
||||||
|
'atcl_no' => $atcl_no,
|
||||||
|
'cpid' => $cpid,
|
||||||
|
'realtor_nm' => $realtor_nm,
|
||||||
|
'stat_cd' => $stat_cd, // 서류확인 완료
|
||||||
|
'proc_tm' => $proc_tm,
|
||||||
|
'address_code' => $address_code,
|
||||||
|
'address2' => $address2,
|
||||||
|
'charger' => $insert_id,
|
||||||
|
'dept1_sq' => $dept1_sq,
|
||||||
|
'dept2_sq' => $dept2_sq,
|
||||||
|
'send_yn' => $send_yn,
|
||||||
|
];
|
||||||
|
|
||||||
|
// DB
|
||||||
|
$builder = $this->db->table('fax_imgs')->where('fax_sq', $fax_sq);
|
||||||
|
$ok = $builder->update($dataFaxImgs);
|
||||||
|
|
||||||
|
if ($ok === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'msg' => 'fax_imgs 저장 실패',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 중개서 요청 메모 저장
|
||||||
|
public function saveRequestMessage($rcpt_sq, $rsrv_sq, $msg)
|
||||||
|
{
|
||||||
|
$usr_id = session('usr_id');
|
||||||
|
|
||||||
|
$this->db->transStart();
|
||||||
|
|
||||||
|
if (empty($rsrv_sq)) {
|
||||||
|
$sql = "SELECT rsrv_sq FROM result WHERE rcpt_sq = ? ORDER BY rsrv_sq DESC LIMIT 1";
|
||||||
|
$query = $this->db->query($sql, [$rcpt_sq]);
|
||||||
|
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
$rsrv_sq = $row['rsrv_sq'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT result_cd3, request_msg FROM result WHERE rsrv_sq = ?";
|
||||||
|
$query = $this->db->query($sql, [$rsrv_sq]);
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
|
||||||
|
$sql = "UPDATE result SET
|
||||||
|
request_msg = ?
|
||||||
|
WHERE rsrv_sq = ?, rcpt_sq = ?
|
||||||
|
";
|
||||||
|
|
||||||
|
if ($this->db->query($sql, binds: [$msg, $rsrv_sq, $rcpt_sq]) === false) {
|
||||||
|
return [
|
||||||
|
'success' => false,
|
||||||
|
'msg' => '저장 실패',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$memo = "메모변경 : " . $row['request_msg'] . " => " . $msg;
|
||||||
|
$this->saveChangedHistory($rcpt_sq, $row['result_cd3'], 'C19', $usr_id, $memo);
|
||||||
|
|
||||||
|
$this->db->transComplete();
|
||||||
|
|
||||||
|
return [
|
||||||
|
'success' => true,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지정한 매물의 요청번호를 이용하여 요청내역을 가져온다.
|
||||||
|
*/
|
||||||
|
public function get_v2_vrfc_req($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,memo,contact_fail_cnt,sync_yn,reg_try_cnt
|
||||||
|
FROM v2_vrfc_req
|
||||||
|
WHERE vr_sq = ?
|
||||||
|
";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$vr_sq]);
|
||||||
|
|
||||||
|
return $query->getRowArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 거주여부 & DB활용동의여부 만 UPDATE */
|
||||||
|
public function updateResDb($val1, $val2, $sq)
|
||||||
|
{
|
||||||
|
$data = [
|
||||||
|
'resYn' => $val1,
|
||||||
|
'dbUsageArgYn' => $val2,
|
||||||
|
];
|
||||||
|
|
||||||
|
$builder = $this->db->table('result')->where('rcpt_sq', $sq);
|
||||||
|
$ok = $builder->update($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 다음 매물 조회
|
||||||
|
public function getNextFaxImgs($fax_sq)
|
||||||
|
{
|
||||||
|
$this->db->transStart();
|
||||||
|
|
||||||
|
$h_y = $this->get_send_yn('H');
|
||||||
|
$usr_id = session('usr_id');
|
||||||
|
$usr_sq = session('usr_sq');
|
||||||
|
$row_dept = $this->getDepartmentPath($usr_sq);
|
||||||
|
$dept1_sq = '';
|
||||||
|
$dept2_sq = '';
|
||||||
|
if (!empty($row_dept)) {
|
||||||
|
$dept1_sq = $row_dept['dept1_sq'];
|
||||||
|
$dept2_sq = $row_dept['dept2_sq'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($h_y['stop_yn'] == 'N') {
|
||||||
|
$where = '';
|
||||||
|
} else {
|
||||||
|
$where = " AND a.recv_time < date_format(curdate( ), '%Y-%m-%d 17:30:00') ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT a.fax_sq FROM fax_imgs a
|
||||||
|
WHERE a.recv_time > DATE_ADD(NOW(), INTERVAL -7 DAY) " .
|
||||||
|
$where .
|
||||||
|
" AND a.stat_cd = '10'" .
|
||||||
|
" AND a.fax_sq > ?" .
|
||||||
|
" and not exists ( SELECT 'x' from v2_vrfc_req v2 where a.vr_sq = v2.vr_sq AND v2.stat_cd = '40' ) " .
|
||||||
|
" ORDER BY a.fax_sq asc" .
|
||||||
|
" LIMIT 1" .
|
||||||
|
" FOR UPDATE SKIP LOCKED";
|
||||||
|
|
||||||
|
$query = $this->db->query($sql, [$fax_sq]);
|
||||||
|
$row = $query->getRowArray();
|
||||||
|
|
||||||
|
$sql = "UPDATE fax_imgs" .
|
||||||
|
" SET stat_cd = '20', charger='" . $usr_id . "', dept1_sq='" . $dept1_sq . "', dept2_sq='" . $dept2_sq . "'" .
|
||||||
|
" WHERE fax_sq = '" . $row['fax_sq'] . "'";
|
||||||
|
$this->db->query($sql);
|
||||||
|
|
||||||
|
$this->db->transComplete();
|
||||||
|
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 변경내용 저장
|
||||||
|
public function saveChangedHistory($rcpt_sq, $rcpt_stat, $changed_type, $usr_id, $remark)
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO changed_history" .
|
||||||
|
" (rcpt_sq, rcpt_stat, changed_type, changed_id, changed_tm, remark)" .
|
||||||
|
" VALUES" .
|
||||||
|
" (?, ?, ?, ?, now(), ?)";
|
||||||
|
$data = [
|
||||||
|
$rcpt_sq,
|
||||||
|
$rcpt_stat,
|
||||||
|
$changed_type,
|
||||||
|
$usr_id,
|
||||||
|
$remark
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->db->query($sql, $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
1407
app/Views/pages/v2/m708/detail.php
Normal file
1407
app/Views/pages/v2/m708/detail.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -556,8 +556,8 @@
|
|||||||
const rowData = table.row(this).data();
|
const rowData = table.row(this).data();
|
||||||
if (!rowData) return;
|
if (!rowData) return;
|
||||||
|
|
||||||
const vr_sq = rowData.vr_sq;
|
const fax_sq = rowData.fax_sq;
|
||||||
location.href = "<?= site_url('m701/m701a/detail') ?>/" + vr_sq;
|
location.href = "<?= site_url('m708/m708a/detail') ?>/" + fax_sq;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#btnSearch').on('click', function () {
|
$('#btnSearch').on('click', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user