Compare commits

...

44 Commits

Author SHA1 Message Date
yangsh
6d87a209e0 링크이동 수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-09 14:32:54 +09:00
yangsh
a7dca8c5fa 링크이동 수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-09 11:00:15 +09:00
yangsh
9a27018922 사이드메뉴 수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-09 09:49:08 +09:00
yangsh
8b621a065e 현장확인 수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-06 10:38:18 +09:00
53695a1dc3 Merge pull request 'feature/template' (#53) from feature/template into master
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/53
2026-02-05 15:08:43 +09:00
yangsh
d92bbfef1a 713수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-05 15:08:05 +09:00
yangsh
4a8178b185 상세수정 2026-02-05 14:09:49 +09:00
b9b3f43956 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/52
2026-02-05 12:43:00 +09:00
yangsh
790216404c 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-05 12:41:07 +09:00
fc4ce793e3 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/51
2026-02-05 10:37:22 +09:00
yangsh
36355f75f3 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-05 10:36:12 +09:00
ae5677a635 모델 수정 2026-02-04 21:45:23 +09:00
1311dc529a 쿼리문 출력 2026-02-04 21:40:30 +09:00
54f0a2a4d2 수정 2026-02-04 21:27:20 +09:00
9f20f4347a 수정 2026-02-04 21:07:28 +09:00
f9b6336eab 수정 2026-02-04 21:03:31 +09:00
6bed688be0 오류 확인 2026-02-04 20:19:07 +09:00
fef656243c 수정 2026-02-04 20:15:07 +09:00
c93a2035dd 저장 실패시 상세 로그 2026-02-04 20:09:52 +09:00
db70b28eb9 modifyinfo 입력 수정 2026-02-04 20:04:24 +09:00
918e27da67 오타수정 2026-02-04 19:59:45 +09:00
f7bda06ddf Merge branch 'master' of http://192.168.10.243:3000/owrainfo/confirms 2026-02-04 18:34:16 +09:00
2781638f58 db_now format 수정 reg_price_yn -> req_price_yn 으로 수정 2026-02-04 18:34:11 +09:00
c21a137dbb 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/50
2026-02-04 17:54:06 +09:00
yangsh
8b77448128 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-04 17:53:33 +09:00
9a2d0af8d0 v2 파라메터 2026-02-04 17:43:55 +09:00
7143a6bd28 네이버 API 클라이언트 수정 완료 2026-02-04 16:28:59 +09:00
a11d686b2a Merge branch 'master' of http://192.168.10.243:3000/owrainfo/confirms 2026-02-04 16:17:22 +09:00
acbf430ae7 api 수정 2026-02-04 16:17:16 +09:00
c33fb47508 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/49
2026-02-04 15:45:43 +09:00
yangsh
e342d7f916 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-04 15:44:45 +09:00
3bb6741e44 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/48
2026-02-04 13:51:18 +09:00
yangsh
c7856394c0 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-04 13:47:29 +09:00
ecf1be8ab7 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/47
2026-02-04 13:33:28 +09:00
yangsh
99ea553d9a 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-04 13:32:52 +09:00
adcd5aca7d 상세수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/46
2026-02-04 10:49:39 +09:00
yangsh
2c96bd12de 상세수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-04 10:48:51 +09:00
8bb7700a00 새로운 api 2026-02-03 20:47:56 +09:00
cbcd66d5c7 부분수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/45
2026-02-02 16:13:18 +09:00
yangsh
107cc395d6 부분수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-02-02 16:12:17 +09:00
0493cd7708 부분수정
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/44
2026-01-29 10:02:33 +09:00
yangsh
f358b44e16 부분수정
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-01-29 10:02:03 +09:00
44035795d2 조회속도개선
Reviewed-on: http://192.168.10.243:3000/owrainfo/confirms/pulls/43
2026-01-29 09:27:01 +09:00
yangsh
04c28d79f2 조회속도개선
Some checks failed
Close Pull Request / main (pull_request_target) Has been cancelled
2026-01-29 09:26:32 +09:00
78 changed files with 23506 additions and 6459 deletions

267
REFACTORING_REPORT.md Normal file
View File

@@ -0,0 +1,267 @@
# NaverService 리팩토링 완료 보고서
## 📋 개요
NaverService를 **683줄 거대한 단일 파일**에서 **책임 분리 기반의 모듈식 구조**로 리팩토링했습니다.
## 🏗️ 새로운 구조
```
app/Services/
├── NaverService.php (84줄) ✨ 간결화됨
├── ParameterMapper/
│ ├── BaseParameterMapper.php (기본 추상 클래스)
│ ├── TypeSParameterMapper.php (현장확인 데이터 변환)
│ └── TypeV2ParameterMapper.php (일반/서류 데이터 변환)
└── Handlers/
├── TypeSHandler.php (Type S 처리 로직)
└── TypeV2Handler.php (Type V2 처리 로직)
```
---
## 📊 개선 효과
| 메트릭 | 이전 | 이후 | 개선율 |
|--------|------|------|--------|
| **파일 크기** | 683줄 | 84줄 | **87.7% 감소** ⬇️ |
| **메서드 수** | 12개 | 1개 | **91.7% 감소** |
| **순환 복잡도** | 높음 | 낮음 | **상당히 개선** |
| **테스트 용이성** | 어려움 | 쉬움 | **크게 개선** |
| **재사용성** | 낮음 | 높음 | **크게 개선** |
---
## 🔑 핵심 개선 사항
### 1⃣ **NaverService 간결화** (84줄)
```php
// 이전: 683줄의 로직 모두 포함
// 이후: API 호출 + 타입별 위임만 담당
public function processArticle(array $payload): int
{
// 1. 네이버 API 호출
$response = $this->naverClient->getArticleInfo($articleNumber);
// 2. 원본 데이터 Staging 저장
$this->rawStagingModel->insert([...]);
// 3. 타입별 처리 위임
if ($vType === 'S') {
return $this->typeSHandler->handle(...);
} else {
return $this->typeV2Handler->handle(...);
}
}
```
### 2⃣ **ParameterMapper 분리**
네이버 API 응답을 데이터베이스 파라미터로 변환하는 로직 전담
#### BaseParameterMapper (추상 기본 클래스)
- 공통 변환 메서드: `mapOwnerTypeCode()`, `mapTradeType()`, `extractFilesByType()`
- 모든 매퍼의 기반
#### TypeSParameterMapper
```php
// Receipt 테이블용 파라미터
$receiptData = $mapper->mapReceipt($articleNumber, $rawData, $payload);
// Result 테이블용 파라미터
$resultData = $mapper->mapResult($rcptSq, $rawData);
```
#### TypeV2ParameterMapper
```php
// VrfcReq, ArticleInfo, ArticleInfoEtc 파라미터 생성
$vrfcReqParam = $mapper->mapVrfcReq(...);
$articleInfoParam = $mapper->mapArticleInfo(...);
$articleInfoEtcParam = $mapper->mapArticleInfoEtc(...);
```
### 3⃣ **Handler 분리**
각 타입별 비즈니스 로직과 DB 처리 전담
#### TypeSHandler (현장확인)
- Receipt, Result 데이터 저장
- 트랜잭션 관리
- 네이버 동기화
#### TypeV2Handler (일반/서류)
- REG (신규 등록)
- MOD (수정)
- CNC (취소)
- VrfcReq, ArticleInfo, ArticleInfoEtc 처리
---
## 💡 사용 방법
### 기존 코드 (변경 없음)
```php
$naverService = new NaverService();
$result = $naverService->processArticle([
'articleNumber' => '12345',
'requestType' => 'REG',
'requestDatetime' => '2026-01-27 10:00:00'
]);
```
### 내부 동작 (개선됨)
```
1. NaverService::processArticle()
└─ API 호출 + Staging 저장
└─ 타입 분석
2. TypeSHandler::handle() 또는 TypeV2Handler::handle()
└─ ParameterMapper로 데이터 변환
└─ DB 저장 + 트랜잭션 관리
└─ 상태 기록
```
---
## ✅ 이점
### 1. **유지보수성 향상**
- 각 클래스가 단일 책임 원칙 준수
- 메서드 수가 감소하여 이해하기 쉬움
- 로직 변경 시 영향 범위 최소화
### 2. **테스트 용이성**
```php
// 각 컴포넌트를 독립적으로 테스트 가능
$mapper = new TypeSParameterMapper();
$receiptData = $mapper->mapReceipt($articleNumber, $mockRawData, $mockPayload);
$this->assertArrayHasKey('rcpt_key', $receiptData);
$handler = new TypeSHandler();
// MockModel 주입 후 테스트 가능
```
### 3. **재사용성**
- ParameterMapper를 다른 서비스에서 재사용 가능
- Handler를 확장하여 새로운 타입 추가 용이
### 4. **확장성**
새로운 타입 추가 시:
```php
// 1. TypeCParameterMapper 생성
class TypeCParameterMapper extends BaseParameterMapper { ... }
// 2. TypeCHandler 생성
class TypeCHandler { ... }
// 3. NaverService에 추가
public function processArticle(array $payload): int {
// ...
} else if ($vType === 'C') {
return $this->typeCHandler->handle(...);
}
}
```
---
## 🔍 코드 구조 비교
### 이전 (모놀리식)
```
NaverService.php
├── processArticle() → 메인 로직
├── processTypeS() → 현장확인 로직 (160줄)
├── processTypeV2() → 일반/서류 로직 (30줄 + 미완성)
├── insertVrfcReq() → DB 저장
├── v2Parameter() → 파라미터 변환 (60줄)
├── articleInfoParameter() → 파라미터 변환 (150줄)
├── articleInfoEtcParameter() → 파라미터 변환 (60줄)
├── modifyInfoParameter() → 파라미터 변환 (미완성)
└── logAndThrowError() → 에러 처리
```
### 이후 (모듈식)
```
NaverService.php (84줄)
├── processArticle() → 오케스트레이션
ParameterMapper/BaseParameterMapper.php (추상 클래스)
├── mapOwnerTypeCode()
├── mapTradeType()
└── extractFilesByType()
ParameterMapper/TypeSParameterMapper.php
├── mapReceipt()
└── mapResult()
ParameterMapper/TypeV2ParameterMapper.php
├── mapVrfcReq()
├── mapArticleInfo()
└── mapArticleInfoEtc()
Handlers/TypeSHandler.php
└── handle()
Handlers/TypeV2Handler.php
├── handle()
├── handleRegister()
├── handleModify()
└── handleCancel()
```
---
## 📝 파일 목록
### 생성된 파일
1. `app/Services/ParameterMapper/BaseParameterMapper.php` (95줄)
2. `app/Services/ParameterMapper/TypeSParameterMapper.php` (165줄)
3. `app/Services/ParameterMapper/TypeV2ParameterMapper.php` (330줄)
4. `app/Services/Handlers/TypeSHandler.php` (85줄)
5. `app/Services/Handlers/TypeV2Handler.php` (200줄)
### 수정된 파일
1. `app/Services/NaverService.php` (683줄 → 84줄)
---
## ⚡ 성능
- **동작**: 100% 동일 (로직 변경 없음)
- **성능**: 약간의 오버헤드 (메서드 호출 추가) → 무시할 수 있는 수준
- **메모리**: 거의 동일
---
## 🎯 다음 단계
### 1. 단위 테스트 작성
```php
// tests/unit/Services/ParameterMapperTest.php
class TypeSParameterMapperTest extends CIUnitTestCase {
public function testMapReceiptReturnsValidArray()
public function testMapResultCalculatesCorrectDepartment()
}
```
### 2. 통합 테스트
```php
// tests/integration/NaverServiceTest.php
public function testProcessArticleTypeSSuccess()
public function testProcessArticleTypeV2Success()
```
### 3. 추가 개선
- [ ] 에러 처리 강화 (Custom Exception)
- [ ] 로깅 일관성 개선
- [ ] 캐싱 메커니즘 추가
- [ ] 비동기 처리 (동기화, 이메일 등)
---
## ✨ 요약
**코드 라인 수 87.7% 감소** (683 → 84줄)
**단일 책임 원칙 준수**
**테스트 용이성 극대화**
**확장성 및 유지보수성 향상**
**기존 API 호환성 100% 유지**
이제 프로젝트는 **더 깔끔하고, 테스트 가능하고, 확장 가능한 구조**를 가지게 되었습니다! 🚀

View File

@@ -67,11 +67,13 @@ $routes->group('', ['namespace' => 'App\Controllers\Article'], static function (
$routes->get('excel', 'Receipt::excel');
$routes->post('saveTel', 'Receipt::saveTel'); // 연락가능전화 저장
$routes->post('resDbYn', 'Receipt::resDbYn'); // 거주여부 저장
$routes->post('resGround', 'Receipt::resGround'); // 평면도요청 저장
$routes->post('assignRegist', 'Receipt::assignRegist'); // 예약확정 저장
$routes->post('requestMovie', 'Receipt::requestMovie'); // 동영상 촬영여부저장
$routes->post('requestMessage', 'Receipt::requestMessage'); // 중개사메모 저장
$routes->post('rsrvcancel', 'Receipt::rsrvcancel'); // 예약취소
$routes->post('chgStatus', 'Receipt::chgStatus'); // 상태변경
$routes->post('sendSms', 'Receipt::sendSms'); // 문자발송
$routes->post('saveRecInfo', 'Receipt::saveRecInfo'); // 거주인정보저장
$routes->post('uploadFile', 'Receipt::uploadFile'); // 파일업로드
@@ -176,10 +178,19 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
*/
$routes->get('m701a/getResultList', 'M701::getResultList');
$routes->get('m701a/excel', 'M701::excel');
$routes->post('m701a/chgArticleStatus', 'M701::chgArticleStatus'); // 상태정보변경
$routes->post('m701a/changePrice', 'M701::changePrice'); // 가격수정
$routes->post('m701a/chgArticleStatus', 'M701::chgArticleStatus'); // 상태정보변경
$routes->post('m701a/modifyInfo', 'M701::modifyInfo'); // 정보수정
$routes->post('m701a/saveMemo', 'M701::saveMemo'); // 메모저장
$routes->post('m701a/saveDocu', 'M701::saveDocu'); // 서류 저장
$routes->post('m701a/saveTel', 'M701::saveTel'); // 전화정보 저장
$routes->post('m701a/saveRegi', 'M701::saveRegi'); // 등기부등본 저장
$routes->post('m701a/saveFinalRegi', 'M701::saveFinalRegi'); // 검증최종실패 처리
$routes->post('m701a/uploadFile', 'M701::uploadFile'); // 파일업로드
});
/**
@@ -195,7 +206,12 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$routes->get('m702a/getResultList', 'M702::getResultList');
$routes->get('m702a/excel', 'M702::excel');
$routes->post('m702a/updateAssign', 'M702::updateAssign'); // 배정변경
// 서류누락
$routes->post('m702a/saveTel', 'M702::saveTel'); // 전화확인 정보 저장
$routes->post('m702a/modifyInfo', 'M702::modifyInfo'); // 매물정보저장
$routes->post('m702a/saveDocu', 'M702::saveDocu'); // 서류정보저장
$routes->post('m702a/uploadFile', 'M702::uploadFile'); // 파일업로드
});
@@ -220,6 +236,7 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$routes->post('m703a/saveRequestMessage', 'M703::saveRequestMessage'); // 중개사요청사항저장
$routes->post('m703a/saveResult', 'M703::saveResult'); // 결과저장
/**
* 홍보확인서 확인
*/
@@ -238,8 +255,11 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
*/
$routes->get('m704a/getResultList', 'M704::getResultList');
$routes->get('m704a/excel', 'M704::excel');
$routes->post('m704a/modifyInfo', 'M704::modifyInfo'); // 매물정보 저장
$routes->post('m704a/uploadFile', 'M704::uploadFile'); // 파일업로드
$routes->post('m704a/saveMemo', 'M704::saveMemo'); // 메모저장
$routes->post('m704a/contactFail', 'M704::contactFail'); // 통화실패 저장
$routes->post('m704a/saveTel', 'M704::saveTel'); // 전화확인정보 저장
$routes->post('m704a/getNextFaxImgs', 'M704::getNextFaxImgs'); // 다음매물확인
});
@@ -261,7 +281,8 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$routes->post('m705a/uploadFile', 'M705::uploadFile'); // 파일업로드
$routes->post('m705a/getNextInfo', 'M705::getNextInfo'); // 다음매물확인
$routes->post('m705a/nextRegi', 'M705::saveRegi'); // 매물저장
$routes->post('m705a/saveRegi', 'M705::saveRegi'); // 매물저장
$routes->post('m705a/getNextInfo', 'M705::getNextInfo'); // 다음매물
});
@@ -279,6 +300,10 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$routes->get('m706a/getResultList', 'M706::getResultList');
$routes->get('m706a/excel', 'M706::excel');
$routes->post('m706a/modifyInfo', 'M706::modifyInfo'); // 매물정보 저장
$routes->post('m706a/saveDocu', 'M706::saveDocu'); // 서류정보 저장
$routes->post('m706a/saveRegi', 'M706::saveRegi'); // 등기부등본 저장
});
/**
@@ -301,7 +326,8 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$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/saveBunyangCnt', 'M708::saveBunyangCnt'); // 분양계약서조회
$routes->post('m708a/saveResult3', 'M708::saveResult3'); // 분양계약서저장
$routes->post('m708a/getNextFaxImgs', 'M708::getNextFaxImgs'); // 다음매물
});
@@ -390,7 +416,8 @@ $routes->group('', ['namespace' => 'App\Controllers\V2'], static function ($rout
$routes->get('m713a/excel', 'M713::excel');
$routes->post('m713a/rotateImage', 'M713::rotateImage'); // 이미지 회전
$routes->post('m713a/saveCorpOwn', 'M713::saveCorpOwn'); // 법인매물저장
$routes->post('m713a/saveRegi', 'M713::saveRegi'); // 매물저장
$routes->post('m713a/saveModify', 'M713::saveModify');
$routes->post('m713a/saveRegi', 'M713::saveRegi'); // 등기부등본 저장
$routes->post('m713a/nextRegi', 'M713::nextRegi'); // 다음매물
});

View File

@@ -267,9 +267,9 @@ class Dept extends BaseController
public function detail($id): string
{
$id = (int) $id;
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}

View File

@@ -2,10 +2,14 @@
namespace App\Controllers\Article;
use App\Controllers\BaseController;
use App\Libraries\Common;
use App\Libraries\MyUpload;
use App\Libraries\NaverApiClient;
use App\Models\article\DeptModel;
use App\Models\article\ReceiptModel;
use App\Models\common\CodeModel;
use Exception;
class Receipt extends BaseController
{
@@ -19,18 +23,31 @@ class Receipt extends BaseController
public function lists(): string
{
$usr_id = $this->request->getGet('usr_id') ?: '';
$sBonbu = $this->request->getGet('bonbu') ?: '';
$sTeanm = $this->request->getGet('dept_sq') ?: '';
$codes = $this->codeModel->getCodeLists(['NHN_DEAL_TYPE', 'CP_ID', 'ARTICLE_TYPE', 'VRFCREQ_WAY', 'STEP_VERIFICATION']); // 코드조회
$sido = $this->model->getAreaList(); // 지역조회
$bonbu = $this->model->getBonbuList();
$team = $this->model->getTeamList();
$user = $this->model->getUserList();
$this->data['sido'] = $sido;
$this->data['bonbu'] = $bonbu;
$this->data['team'] = $team;
$this->data['user'] = $user;
$this->data['codes'] = $codes;
if (!empty($usr_id)) {
$srchUser = $this->model->getSrchUserInfo($usr_id);
$this->data['srchUser'] = $srchUser;
}
$this->data['sBonbu'] = $sBonbu;
$this->data['sTeanm'] = $sTeanm;
return view("pages/article/receipt/lists", $this->data);
}
@@ -142,15 +159,28 @@ class Receipt extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
$t0 = microtime(true);
$codes = $this->codeModel->getCodeLists(['TRADE_TYPE', 'RECEIPT_STATUS2', 'RECEIPT_STATUS3', 'SMS_MSG_TYPE', 'SMS_MSG_TYPE2']); // 코드조회
log_message('info', '[Receipt::detail] getCodeLists {ms}ms', ['ms' => (int) ((microtime(true) - $t0) * 1000)]);
$t1 = microtime(true);
$bonbu = $this->model->getBonbuList();
log_message('info', '[Receipt::detail] getBonbuList {ms}ms', ['ms' => (int) ((microtime(true) - $t1) * 1000)]);
$t2 = microtime(true);
$team = $this->model->getTeamList();
log_message('info', '[Receipt::detail] getTeamList {ms}ms', ['ms' => (int) ((microtime(true) - $t2) * 1000)]);
$damdang = $this->model->getUserList();
// sms 코드
$sms = [];
@@ -159,42 +189,96 @@ class Receipt extends BaseController
array_push($sms, $c);
}
$t3 = microtime(true);
$data = $this->model->getDetail($id);
$history = $this->model->getHistory($id);
log_message('info', '[Receipt::detail] getDetail {ms}ms', ['ms' => (int) ((microtime(true) - $t3) * 1000)]);
$t4 = microtime(true);
$history = $this->model->getHistory($id);
log_message('info', '[Receipt::detail] getHistory {ms}ms', ['ms' => (int) ((microtime(true) - $t4) * 1000)]);
$t5 = microtime(true);
if ($data['rcpt_jibun_addr']) {
$dupleGroundPlan = $this->model->getDupleGP_na($id, $data['rcpt_sido'], $data['rcpt_gugun'], $data['rcpt_dong'], $data['rcpt_hscp_nm'], $data['rcpt_dtl_addr'], $data['rcpt_li_addr'], $data['rcpt_jibun_addr'], $data['rcpt_etc_addr']);
} else {
$dupleGroundPlan = $this->model->getDupleGP($id, $data['rcpt_sido'], $data['rcpt_gugun'], $data['rcpt_dong'], $data['rcpt_hscp_nm'], $data['rcpt_dtl_addr'], $data['rcpt_ho']);
}
log_message('info', '[Receipt::detail] getDupleGP {ms}ms', ['ms' => (int) ((microtime(true) - $t5) * 1000)]);
$t6 = microtime(true);
$aptGround = $this->model->getAptGround($data['rcpt_dong'] ?? '');
log_message('info', '[Receipt::detail] getAptGround {ms}ms', ['ms' => (int) ((microtime(true) - $t6) * 1000)]);
// 이미지 파일리스트
$t7 = microtime(true);
$images = $this->model->getImageList2($data['rsrv_sq']);
log_message('info', '[Receipt::detail] getImageList2 {ms}ms', ['ms' => (int) ((microtime(true) - $t7) * 1000)]);
$t8 = microtime(true);
$imgs_count = $this->model->getImageCountByType($data['rsrv_sq']);
log_message('info', '[Receipt::detail] getImageCountByType {ms}ms', ['ms' => (int) ((microtime(true) - $t8) * 1000)]);
$imgs_count = convertArrayToHashTable($imgs_count, 'img_type', 'img_cnt');
//녹취파일
$t9 = microtime(true);
$record = $this->model->getRecordInfo($data['rsrv_sq']);
log_message('info', '[Receipt::detail] getRecordInfo {ms}ms', ['ms' => (int) ((microtime(true) - $t9) * 1000)]);
// 시간대별통계
$t10 = microtime(true);
$tmCount = $this->model->getUsrRsrvDateTmCount($id);
log_message('info', '[Receipt::detail] getUsrRsrvDateTmCount {ms}ms', ['ms' => (int) ((microtime(true) - $t10) * 1000)]);
// 당일 방문예정 매물.
$assignList = $this->model->getAssignReceiptListByUser($data['rsrv_date'], $data['usr_sq'], array($id));
// 체크리스트 조회
$t11 = microtime(true);
if ($data['exp_photo_yn'] === "N") {
$result_check = $this->model->getChecklist($data['rsrv_sq']);
} else {
$result_check = [];
}
$pdept = '';
if (!empty($data['dept_sq'])) {
$pdept = $this->model->getDeptDetail($data['dept_sq']);
} else {
$pdept = $this->model->getDeptDetail($data['region_dept_sq']);
}
$complexList = [];
$ptpList = [];
// print_r($data);
// exit;
if ($data['comp_sq'] == '2') {
// 아파트단지목록
$complexList = $naver->complexList($data['rcpt_dong']);
// 평형목록
$ptpList = $naver->ptpList($data['rcpt_hscp_no']);
}
// print_r($ptpList);
// exit;
log_message('info', '[Receipt::detail] getChecklist {ms}ms', ['ms' => (int) ((microtime(true) - $t11) * 1000)]);
log_message('info', '[Receipt::detail] total {ms}ms', ['ms' => (int) ((microtime(true) - $t0) * 1000)]);
$this->data['codes'] = $codes;
$this->data['bonbu'] = $bonbu;
$this->data['team'] = $team;
$this->data['damdang'] = $damdang;
$this->data['pdept'] = $pdept;
$this->data['sms'] = $sms;
$this->data['data'] = $data;
$this->data['assignList'] = $assignList;
$this->data['history'] = $history;
$this->data['dupleGroundPlan'] = $dupleGroundPlan;
@@ -208,6 +292,9 @@ class Receipt extends BaseController
$this->data['tmCount'] = $tmCount;
$this->data['result_check'] = $result_check;
$this->data['complexList'] = $complexList;
$this->data['ptpList'] = $ptpList;
return view("pages/article/receipt/detail", $this->data);
}
@@ -236,6 +323,48 @@ class Receipt extends BaseController
}
}
// 거주여부 저장
public function resDbYn()
{
$naver = new NaverApiClient();
try {
$rcpt_key = $this->request->getPost('rcpt_key');
$rcpt_sq = $this->request->getPost('rcpt_sq');
$rsrv_sq = $this->request->getPost('rsrv_sq');
$res_yn = $this->request->getPost('resYn');
$dbUsageAgrYn = $this->request->getPost('dbUsageAgrYn');
$this->model->saveResDB($rcpt_sq, $rsrv_sq, $res_yn, $dbUsageAgrYn);
$receipt = $this->getDetail($rcpt_key);
if ($res_yn == 'Y') {
$isResidentsExist = true;
} else {
$isResidentsExist = false;
}
$api_result = $naver->residentsExistence($rcpt_key, $isResidentsExist);
if (!isset($api_result['result'])) {
throw new \Exception('API 통신오류입니다.\n다시 저장하여 주십시요.');
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 평면도요청 저장
public function resGround()
{
@@ -263,13 +392,42 @@ class Receipt extends BaseController
// 예약확정 저장
public function assignRegist()
{
$naver = new NaverApiClient();
$deptModel = new DeptModel();
try {
//전달받은 값
$rcpt_sq = $this->request->getPost('rcpt_sq');
$rcpt_key = $this->request->getPost('rcpt_key');
$rsrv_sq = $this->request->getPost('rsrv_sq');
$rsrv_date = $this->request->getPost('rsrv_date');
$rsrv_tm_ap = $this->request->getPost('rsrv_tm_ap');
$rsrv_tm_hour = $this->request->getPost('rsrv_tm_hour');
$bonbu = $this->request->getPost('bonbu');
$dept_sq = $this->request->getPost('dept_sq');
$usr_sq = $this->request->getPost('usr_sq');
$bonbuInfo = $deptModel->getDeptDetail($bonbu);
$deptInfo = $deptModel->getDeptDetail($dept_sq);
$userInfo = $this->model->getUserDetail($usr_sq);
$receipt = $this->model->getDetail($rcpt_key);
/*** 네이버 연동[s] ***/
$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] ***/
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
$result = $this->model->assignRegist($rcpt_sq, $rsrv_date, $rsrv_tm_ap, $rsrv_tm_hour, $dept_sq, $usr_sq, $receipt);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} else {
throw new \Exception($na_result['message']);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
@@ -332,10 +490,44 @@ class Receipt extends BaseController
// 예약취소
public function rsrvcancel()
{
$naver = new NaverApiClient();
try {
//전달받은 값
$rcpt_sq = $this->request->getPost('rcpt_sq');
$rsrv_sq = $this->request->getPost('rsrv_sq');
$rcpt_key = $this->request->getPost('rcpt_key');
$result_cd2 = $this->request->getPost('result_cd2');
$result_cd3 = $this->request->getPost('result_cd3');
$result_msg = $this->request->getPost('result_msg');
$rcpt_stat1 = $this->request->getPost('rcpt_stat1');
$receipt = $this->model->getDetail($rcpt_key);
/*** 네이버 연동[s] ***/
if ($result_cd2 == '9010' || $result_cd2 == '9020') { //예약취소
$na_result = $naver->reserveFail($rcpt_key, "E11", $result_msg);
} else if ($result_cd2 == '9030') {
if ($rcpt_stat1 == '70') {
throw new \Exception('방문전 취소 할 수 없습니다.');
} else {
$na_result = $naver->shootFail($rcpt_key, "E21", $result_msg);
}
} else if ($result_cd2 == '9040') {
$na_result = $naver->shootFail($rcpt_key, "E22", $result_msg);
} else if ($result_cd2 == '9045') {
$na_result = $naver->shootFail($rcpt_key, "E23", $result_msg);
} else if ($result_cd2 == '9050') {
$na_result = $naver->inspectFail($rcpt_key, 'E31', $result_msg);
}
/*** 네이버 연동[e] ***/
if (array_key_exists('result', $na_result)) { //네이버연동 상태변경 완료
$result = $this->model->rsrvcancel($rcpt_sq, $rsrv_sq, $result_cd2, $result_cd3, $result_msg, $receipt);
} else {
throw new \Exception($na_result['message']);
}
return $this->response->setJSON([
'code' => '0',
@@ -350,6 +542,55 @@ class Receipt extends BaseController
}
}
// 상태변경
public function chgStatus()
{
try {
$rcpt_sq = $this->request->getPost('rcpt_sq');
$rcpt_key = $this->request->getPost('rcpt_key');
$rcpt_stat = $this->request->getGet('rcpt_stat');
$rsrv_sq = $this->request->getPost('rsrv_sq');
$req_rec_yn = $this->request->getGet('reqRecYn');
$rsrv_date = $this->request->getPost('rsrv_date');
$rsrv_tm_ap = $this->request->getPost('rsrv_tm_ap');
$rsrv_tm_hour = $this->request->getPost('rsrv_tm_hour');
$bonbu = $this->request->getPost('bonbu');
$dept_sq = $this->request->getPost('dept_sq');
$usr_sq = $this->request->getPost('usr_sq');
$rletTypeCd = $this->request->getGet('rletTypeCd');
// 파라미터 디버그 로깅
$p = [
'rcpt_sq' => $rcpt_sq,
'rcpt_key' => $rcpt_key,
'rcpt_stat' => $rcpt_stat,
'rsrv_sq' => $rsrv_sq,
'req_rec_yn' => $req_rec_yn,
'rsrv_date' => $rsrv_date,
'rsrv_tm_ap' => $rsrv_tm_ap,
'rsrv_tm_hour' => $rsrv_tm_hour,
'bonbu' => $bonbu,
'dept_sq' => $dept_sq,
'usr_sq' => $usr_sq,
'rletTypeCd' => $rletTypeCd,
];
print_r($p);
exit;
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 문자발송
public function sendSms()

View File

@@ -120,9 +120,9 @@ class Record extends BaseController
public function detail($id): string
{
$id = (int) $id;
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M703Model;
@@ -125,9 +126,10 @@ class M703 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -161,11 +163,11 @@ class M703 extends BaseController
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
$villa_rlet_type_cd = ['A05', 'A06'];
if (in_array($article['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
// $detail_hscp = $this->call_kiso_api->aptDetail($article['hscp_no']);
$detail_hscp = $naver->aptDetail($article['hscp_no']);
}
if (in_array($article['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
// $detail_hscp = $this->call_kiso_api->villaDetail($article['hscp_no']);
$detail_hscp = $naver->villaDetail($article['hscp_no']);
}
$this->data['hscp_info'] = $hscp_info;
@@ -400,6 +402,8 @@ class M703 extends BaseController
// 결과저장
public function saveResult()
{
$naver = new NaverApiClient();
try {
$fax_sq = $this->request->getPost('fax_sq');
@@ -461,8 +465,7 @@ class M703 extends BaseController
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
// $this->load->library('call_kiso_api');
// $send_result = $this->call_kiso_api->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
}
if ($send_result['result'] == 'success') {

View File

@@ -3,8 +3,12 @@ namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\MyUpload;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M704Model;
use App\Models\v2\M710Model;
use Exception;
class M704 extends BaseController
{
@@ -121,9 +125,11 @@ class M704 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$naver = new NaverApiClient();
if ($id <= 0) {
$id = (string) $id;
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -137,6 +143,33 @@ class M704 extends BaseController
$phone_list = $this->model->getPhoneNumber(); // 주택임대사업자번호 리스트
$tel = $this->model->getRecordInfo($id, '3'); //녹취파일
$complexList = [];
$ptpList = [];
// 아파트단지목록
$complexList = $naver->complexList($data['address_code']);
// 평형목록
$ptpList = $naver->ptpList($data['hscp_no']);
$hscp_info = [];
if (!empty($data['hscp_no'])) {
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
$villa_rlet_type_cd = ['A05', 'A06'];
if (in_array($data['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
$detail_hscp = $naver->aptDetail($data['hscp_no']);
}
if (in_array($data['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
$detail_hscp = $naver->villaDetail($data['hscp_no']);
}
$hscp_info = $detail_hscp['result'];
}
$this->data['codes'] = $codes;
$this->data['data'] = $data;
@@ -145,10 +178,99 @@ class M704 extends BaseController
$this->data['regist2'] = $regist2;
$this->data['phone_list'] = $phone_list;
$this->data['tel'] = $tel;
$this->data['complexList'] = $complexList;
$this->data['ptpList'] = $ptpList;
$this->data['detail_hscp'] = $hscp_info;
return view("pages/v2/m704/detail", $this->data);
}
// 상세정보 수정
public function modifyInfo()
{
$naver = new NaverApiClient();
try {
$atcl_vr_sq = $this->request->post('rcpt_key', TRUE); //순번
$atcl_hscp_nm = $this->request->getPost('atcl_hscp_nm'); //단지명
$atcl_ptp_nm = $this->request->getPost('atcl_ptp_nm'); //평형명
$atcl_vrfc_type = $this->request->getPost('atcl_vrtc_way'); //검증구분
$trade_type = $this->request->getPost('trade_type_cd'); //거래구분
$atcl_addr1 = $this->request->getPost('atcl_addr1'); //상세주소1 폐기예정
$atcl_addr1a = $this->request->getPost('atcl_addr1a'); // 리 주소
$atcl_addr1b = $this->request->getPost('atcl_addr1b'); // 공동 : 동 주소, 비공동 : 지번주소
$atcl_addr2 = $this->request->getPost('atcl_addr2'); //상세주소2
$atcl_hscp_no = $this->request->getPost('atcl_hscp_no'); //단지번호
$atcl_ptp_no = $this->request->getPost('atcl_ptp_no'); //단지명
$atcl_amt1 = $this->request->getPost('atcl_amt1');
$atcl_amt2 = $this->request->getPost('atcl_amt2');
$atcl_amt3 = $this->request->getPost('atcl_amt3');
$atcl_amt4 = $this->request->getPost('atcl_amt4'); // 분양권매매 가격 2
$isale_amt = $this->request->getPost('isale_amt'); // 분양가
$prem_amt = $this->request->getPost('prem_amt'); // 프리미엄가
$atcl_floor = $this->request->getPost('atcl_floor'); // 층
$atcl_floor2 = $this->request->getPost('atcl_floor2'); // 총층
$result = $this->model->saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt);
$resVrfc = $this->model->saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type);
if ($result['error_number'] != 0) {
throw new \Exception($result['error_message']);
} else {
//API 호출
$resultData = $this->model->getDetail($atcl_vr_sq);
$modifyInfo = $naver->modifyInfo(
$resultData['data']['atcl_no'],
$resultData['data']['hscp_no'],
$resultData['data']['ptp_no'],
$resultData['data']['bild_nm'],
$resultData['data']['rm_no'],
$resultData['data']['trade_type_cd'],
$resultData['data']['deal_amt'],
$resultData['data']['wrrnt_amt'],
$resultData['data']['lease_amt'],
$resultData['data']['isale_amt'],
$resultData['data']['prem_amt'],
$resultData['data']['floor'],
$resultData['data']['floor2'],
$resultData['data']['charger'],
$resultData['data']['address_code'],
$resultData['data']['address2'],
$resultData['data']['address2a'],
$resultData['data']['address2b'],
$resultData['data']['address3'],
$resultData['data']['sply_spc'],
$resultData['data']['excls_spc'],
$resultData['data']['tot_spc'],
$resultData['data']['grnd_spc'],
$resultData['data']['bldg_spc']
);
if ($modifyInfo['result'] != 'success') { //결과값 확인
$return = $modifyInfo['error'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $modifyInfo['error']['code'], $modifyInfo['error']['message'], $err_time, $resultData['data']['atcl_no']);
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 파일업로드
public function uploadFile()
{
@@ -248,6 +370,470 @@ class M704 extends BaseController
}
}
// 전화실패
public function contactFail()
{
try {
$vr_sq = $this->request->getPost('vr_sq');
// UPDATE v2_vrfc_req
$this->model->saveContactFail($vr_sq);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 전화확인정보 저장
public function saveTel()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 전화(서류)확인중 상태로 변경. (수정변경이력 저장)
1.5.1 녹취파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 개인정보 제공동의, 매물주소, 가격거래구분, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 전화(서류)확인완료 상태. (수정변경이력 저장)
*/
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s');
$atcl_vrtc_way = $this->request->getPost('atcl_vrtc_way');
$atcl_vr_sq = $this->request->getPost('rcpt_key');
$tel_agree = $this->request->getPost('tel_agree');
// 개인정보 제공 동의가 승인일 경우 필수 필드 검증
if ($tel_agree == '10000') {
$validation = \Config\Services::validation();
$validation->setRules([
'tel_conf_yn_2' => [
'label' => '매물주소',
'rules' => 'required',
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
],
'tel_conf_yn_3' => [
'label' => '가격 거래구분',
'rules' => 'required',
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
],
'tel_conf_yn_4' => [
'label' => '의뢰인정보',
'rules' => 'required',
'errors' => ['required' => '{field} 정보확인 결과를 선택해주세요.']
],
]);
if (!$validation->withRequest($this->request)->run()) {
$errors = $validation->getErrors();
throw new \Exception(implode(', ', $errors));
}
}
// POST 데이터 받기
$tel_suc = $this->request->getPost('tel_suc');
$tel_conf_yn_2 = $this->request->getPost('tel_conf_yn_2');
$tel_conf_yn_3 = $this->request->getPost('tel_conf_yn_3');
$tel_conf_yn_4 = $this->request->getPost('tel_conf_yn_4');
$tel_conf_yn_5 = $this->request->getPost('tel_conf_yn_5');
$tel_conf_yn_info_2 = $this->request->getPost('tel_conf_yn_info_2');
$tel_conf_yn_info_3 = $this->request->getPost('tel_conf_yn_info_3');
$tel_conf_yn_info_4 = $this->request->getPost('tel_conf_yn_info_4');
$address_code = $this->request->getPost('address_code');
$reg_chk_val = $this->request->getPost('reg_chk_val');
$tel_file_yn = $this->request->getPost('tel_file_yn');
$memo = $this->request->getPost('memo_tel');
$tel_fail_cause = $this->request->getPost('tel_fail_cause');
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
$reg_try_cnt = $this->model->getRegTry($atcl_vr_sq);
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
$try_cnt = '0';
if ($resStat['stat_cd'] >= '40' || $resStat['stat_cd'] == '19') {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$this->model->InsCharger($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
$resultCnt = $this->model->chkTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
$chkHistoryStat = $this->model->chkHistoryStat($atcl_vr_sq); // history에 등기부등본 확인중인적이 있는지 확인
if ($resultCnt['try_cnt'] == 0) { //1차 검증일 때
$try_cnt = '1';
} else if ($resultCnt['try_cnt'] == 1) { //2차 검증일 때
$try_cnt = '2';
} else if ($resultCnt['try_cnt'] == 2) { //2차 검증이상 일 때
$try_cnt = '2';
} else {
$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, '');
if ($result == 0) {
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->m704_model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($tel_conf_yn_2 == '10000' && $tel_conf_yn_3 == '10000' && $tel_conf_yn_4 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 10, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
//v2_vrfc_req INSERT//상태변경 TABLE INSERT : 전화(서류)확인중 상태로 변경
$this->model->chgStat($atcl_vr_sq, '30', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '30');
// 불일치건이면서 등기부등본 불일치 1회 이상일 경우 초기상태를 등기부등본 상태로 변경
if ($chk_type == '0' && $reg_try_cnt['reg_try_cnt'] == '1') {
$this->model->chgStat($atcl_vr_sq, '40', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '40');
}
if ($chk_type == '0' && ($reg_try_cnt['reg_try_cnt'] == '1' || $reg_try_cnt['reg_try_cnt'] == '2')) { // $reg_try_cnt['reg_try_cnt'] 는 등기부등본 실패횟수
log_message('debug', 'm704 insertChkList : ' . $atcl_vr_sq);
//v2_check_list 매물정보확인 INSERT : 전화매물확인 페이지에서 통신하는 등기부등본 확인 API이므로 값을 강제로 넣어줌.
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', '20000', '불일치');
//v2_check_list 의뢰인정보 INSERT : 전화매물확인 페이지에서 통신하는 등기부등본 확인 API이므로 값을 강제로 넣어줌.
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', '20000', '불일치');
} else {
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11', $tel_agree, '');
if ($tel_agree == '10000') {
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12', $tel_conf_yn_2, $tel_conf_yn_info_2);
//v2_check_list 가격거래구분 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13', $tel_conf_yn_3, $tel_conf_yn_info_3);
//v2_check_list 의뢰인정보 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14', $tel_conf_yn_4, $tel_conf_yn_info_4);
} else {
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T12');
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T13');
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T14');
}
if (!empty($tel_conf_yn_5)) {
// $this->m704_model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15', $tel_conf_yn_5, $tel_conf_yn_5);
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15', $tel_conf_yn_5, '');
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T11');
} else {
$this->model->deleteChkList($atcl_vr_sq, $atcl_vrtc_way, 'T15');
}
}
//memo 저장
if (!empty($memo)) {
$this->model->saveMemo([$memo, $atcl_vr_sq]);
}
//전화실패 사유 저장
if (!empty($tel_fail_cause)) {
$this->model->up_tel_fail_cause($atcl_vr_sq, $tel_fail_cause);
}
//확인정보 수정 로그 찍기
log_message('debug', 'checking >> 검증횟수(등기부등본) : ' . $reg_try_cnt['reg_try_cnt'] . '/' . ' >> chk_type : ' . $chk_type . ' 매물번호 : ' . $atcl_vr_sq);
// 전화서류가 불일치이고 등기부등본 실패횟수가 1회일 때 바로 등기부등본 불일치 >> 검증실패 처리
// [s] 2015.09.08 등기부등본 검증 API 추가
if ($chk_type == '0' && ($reg_try_cnt['reg_try_cnt'] == '1' || $reg_try_cnt['reg_try_cnt'] == '2')) {
log_message('debug', '704 page (등기부등본 불일치) >> before call api / 매물번호 : ' . $atcl_vr_sq);
//☆
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
$t_yn = $model710->get_send_yn('T');
if ($t_yn['stop_yn'] == 'N') { //전송금지
//1.해당매물정보를v2_stop_api_save_info에다 넣음
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'T2', '');
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
//API 호출
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
}
if ($send_result['result'] == 'success') {
log_message('debug', '704 page (등기부등본 불일치) >> success call api / 매물번호 : ' . $atcl_vr_sq);
// 전화서류를 처리한 모든건을 카운트 하는
$result_query1 = $this->model->chgStat($atcl_vr_sq, '38', $toDay);
//상태변경 TABLE INSERT : 등기부등본 불일치 상태로 변경
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
$this->model->chgRegTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
//★검증실패
if ($atcl_vrtc_way == 'M' || $atcl_vrtc_way == 'O') { //모바일은 등기가 첨 시작이니까 insert해줘야함
if (!($atcl_vrtc_way == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_way, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_way, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0302', '1', 'add'); // 최종실패로 저장
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
} else {
$sendData = $this->model->getDataConfirmAPI($atcl_vr_sq);
$t_yn = $model710->get_send_yn('T');
if ($t_yn['stop_yn'] == 'N') { //전송금지
//1.해당매물정보를v2_stop_api_save_info에다 넣음
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'T1', '');
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
//API 호출
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
}
if ($send_result['result'] == 'success' || $send_result['error']['code'] == 'VC013') {
// 검증단계가 상이하더라도 상태값이 변경될 수 있도록 함.
if ($tel_agree == '10000' && $chk_type == '1') {
//상태변경 TABLE INSERT : 전화(서류)확인 완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '35', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '35'); //v2_vrfc_req INSERT
// 전화서류를 처리한 모든건을 카운트
$this->model->chgStat($atcl_vr_sq, '38', $toDay);
if ($reg_chk_val == '1') {
//등기부등본 확인 대상은 전화(서류)확인 완료 후 -> 등기부등본 확인중 상태로 변경.
$result_query8 = $this->model->chgStat($atcl_vr_sq, '40', $toDay);
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
//★등기 로 넘어갈때
//0.통화실패 여부를 확인한다
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
//1.서류전화 들어온시간
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
//2.서류/전화 확인일자
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$sf = 'T';
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
}
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0201', '1', 'add'); // 일치로 저장
} else {
//등기부등본 확인 대상이 아닌 경우 전화(서류)확인 완료 후 -> 검증 완료 상태로 변경.
$result_query8 = $this->model->chgStat($atcl_vr_sq, '60', $toDay);
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
//★검증완료일때
//0.통화실패 여부를 확인한다
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
//1.서류전화 들어온시간
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
//2.서류/전화 확인일자
$tel_doc_conf_dt = $model415->getConfTimeForHistory($atcl_vr_sq);
//3.검증완료시간
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
}
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0206', '1', 'add'); // 전화확인완료 등기부등본확인 안함 저장
}
} else {
if ($try_cnt == '1') {
// 전화서류를 처리한 모든건을 카운트
$result_query19 = $this->model->chgStat($atcl_vr_sq, '38', $toDay);
//상태변경 TABLE INSERT : 전화(서류)확인 불일치 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '39', $toDay);
$chgVrfc35 = $this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
//★불일치
//0.통화실패 여부를 확인한다
$cnt = $model415->getCallfailForHistory($atcl_vr_sq);
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
//1.서류전화 들어온시간
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
//2.서류/전화 불일치 시간
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$sf = 'F';
$model415->insert_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $sf);
}
//v2_vrfc_req try_cnt 값을 1로 update
$res_try = $this->model->chgTryCnt($atcl_vr_sq, '1');
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0301', '1', 'add'); // 1차실패로 저장
} else if ($try_cnt == '2') { //상태변경 TABLE INSERT : 전화(서류)확인 불일치 상태로 변경
// 전화서류를 처리한 모든건을 카운트
$this->model->chgStat($atcl_vr_sq, '38', $toDay);
$this->model->chgStat($atcl_vr_sq, '39', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
//★ 검증실패
//0.통화실패 여부를 확인한다
$cnt = $this->model->getCallfailForHistory($atcl_vr_sq);
if (empty($cnt)) { //통화실패가 없어야 통계를 구한다
//1.서류전화 들어온시간
$insert_tm = $model415->getSaveTimeForHistory($atcl_vr_sq);
//2.서류/전화 불일치 시간
$tel_doc_conf_dt = $model415->getFaxFailTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $v2_vrfc_req['vrfc_type'], $insert_tm['insert_tm'], $tel_doc_conf_dt['insert_tm'], $finishTime['insert_tm']);
}
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0302', '1', 'add'); // 최종실패로 저장
}
if (in_array($tel_agree, array('20001', '20002'))) {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0203', '1', 'add'); // 거부로 저장
} elseif (in_array($tel_agree, array('20003', '20004', '20005'))) {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0204', '1', 'add'); // 무응답 외
} else {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'T0202', '1', 'add'); // 불일치
}
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
}
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 다음 매물정보 조회
public function getNextTelInfo()

View File

@@ -4,8 +4,11 @@ namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\Common;
use App\Libraries\MyUpload;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M705Model;
use App\Models\v2\M710Model;
class M705 extends BaseController
{
@@ -150,9 +153,10 @@ class M705 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -165,6 +169,24 @@ class M705 extends BaseController
$display = $this->model->getDisplay('M705_detail');
$reference = $this->model->getAllRecordInfo($id, '7'); //참고용파일 (2017.09.26 추가)
$hscp_info = [];
if (!empty($data['hscp_no'])) {
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
$villa_rlet_type_cd = ['A05', 'A06'];
if (in_array($data['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
$detail_hscp = $naver->aptDetail($data['hscp_no']);
}
if (in_array($data['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
$detail_hscp = $naver->villaDetail($data['hscp_no']);
}
$hscp_info = $detail_hscp['result'];
}
$this->data['codes'] = $codes;
$this->data['data'] = $data;
$this->data['record'] = $record;
@@ -172,6 +194,7 @@ class M705 extends BaseController
$this->data['memo'] = $memo;
$this->data['display'] = $display;
$this->data['reference'] = $reference;
$this->data['detail_hscp'] = $hscp_info;
return view("pages/v2/m705/detail", $this->data);
}
@@ -258,49 +281,51 @@ class M705 extends BaseController
$usr_id = session('usr_id');
$vr_sq = $this->request->getPost('vr_sq');
$file = $this->request->getFile('file');
if ($file && $file->isValid() && !$file->hasMoved()) {
$uploadPath = "/upload/v2_file/" . $vr_sq . "/";
$files = $this->request->getFiles();
$arrUploadfile = [];
if ($file->isValid() && !$file->hasMoved()) {
$uploadData = $lib->do_upload2($file, $uploadPath);
$uploadPath = "/upload/v2_file/" . $vr_sq . "/";
if ($uploadData !== false) {
$arrUploadfile[] = $uploadData;
}
}
if (!empty($arrUploadfile)) {
foreach ($arrUploadfile as $key => $uploadFile) {
$data = [
'vr_sq' => $vr_sq,
// 'file_sq' => $this->request->getPost('file_sq'),
'orig_name' => $uploadFile['origin_name'],
'new_name' => $uploadFile['file_name'],
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
'ext' => '.' . $uploadFile['ext'],
'size' => $file->getSize(),
'img_yn' => null,
'img_height' => null,
'img_width' => null,
'usr_id' => $usr_id,
];
}
if (!empty($data)) {
// 파일업로드 정보 저장
$this->model->saveFileInfo($data);
}
}
$file = $files['files'];
$arrUploadfile = [];
$uploadData = $lib->do_upload2($file, $uploadPath);
if ($uploadData !== false) {
$arrUploadfile[] = $uploadData;
}
if (!empty($arrUploadfile)) {
foreach ($arrUploadfile as $key => $uploadFile) {
$data = [
'vr_sq' => $vr_sq,
// 'file_sq' => $this->request->getPost('file_sq'),
'orig_name' => $uploadFile['origin_name'],
'new_name' => $uploadFile['file_name'],
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
'ext' => '.' . $uploadFile['ext'],
'size' => $file->getSize(),
'img_yn' => null,
'img_height' => null,
'img_width' => null,
'usr_id' => $usr_id,
];
// print_r($data);
// exit;
// if (!empty($data)) {
// 파일업로드 정보 저장
$this->model->saveFileInfo($data);
// }
}
}
return $this->response->setJSON([
'code' => '0',
@@ -317,6 +342,384 @@ class M705 extends BaseController
}
// 매물정보 저장
public function saveRegi()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 등기부등본 확인중 상태로 변경. (수정변경이력 저장)
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 매물주소, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 등기부등본 확인완료 상태. (수정변경이력 저장)
*/
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s');
$atcl_vrtc_way = 'R'; //검증구분
$atcl_vr_sq = $this->request->getPost('rcpt_key');
// $atcl_no = $this->request->getPost('atcl_no');
$reg_conf_yn_1 = $this->request->getPost('reg_conf_yn_1'); //확인내용
$reg_conf_yn_2 = $this->request->getPost('reg_conf_yn_2'); //매물주소
$reg_conf_yn_3 = $this->request->getPost('reg_conf_yn_3'); //의뢰인정보
$reg_conf_yn_info_2 = $this->request->getPost('reg_conf_yn_info_2'); //매물주소
$reg_conf_yn_info_3 = $this->request->getPost('reg_conf_yn_info_3'); //의뢰인정보
$memo = $this->request->getPost('memo'); //메모
$owner_verifiable = $this->request->getPost('owner_verifiable'); //실소유주 확인여부
$noimg_chk_chk = $this->request->getPost('noimg_chk_chk'); // 등기부등본이미지 파일없음.
$img_chk_chk = $this->request->getPost('img_chk_chk'); // 등기소, 리얼탑 열람, 리얼탑 기열람, 열람
$atcl_vrtc_type = $this->request->getPost('atcl_vrtc_type'); // 검증구분
$vrfc_type_sub = $this->request->getPost('vrfc_type_sub'); // 하위검증구분
$arr_uncnfrm_status = $this->request->getPost('arr_uncnfrm_status'); // 등기부등본 미확인여부 상세
$try_cnt = '0';
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
if ($resStat['stat_cd'] >= '60' || $resStat['stat_cd'] == '19') {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$resultCnt = $this->model->chkRegiTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
if ($resultCnt['reg_try_cnt'] == 0) { // 1차 검증일 때
log_message('debug', '705 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 0 ');
$try_cnt = '1';
} else if ($resultCnt['reg_try_cnt'] == 1) { // 2차 검증일 때
log_message('debug', '705 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 1 ');
$try_cnt = '2';
} else {
log_message('debug', '705 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 예외처리 ');
$try_cnt = '2';
//$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, $atcl_vrtc_way);
if ($result == 0) { //v2_confirm 존재하지 않는다면
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
// 수정한 시간이 현재시간10분전 보다 클 경우 수정불가능
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
$this->model->InsResChar($atcl_vr_sq); //담당자 업데이트
// 모바일v1,v2고 등기부등본 미확인여부 상세 저장
if ($vrfc_type_sub == 'M1' || $vrfc_type_sub == 'O1') {
$this->model->add_cert_uncnfrm_status($atcl_vr_sq, $arr_uncnfrm_status);
if (strpos($arr_uncnfrm_status, '20020') !== false) { //등기부등본 미확인여부 상세에 20020(파일 오첨부)있고
if ($vrfc_type_sub == 'M1') { // 모바일v1일땐 코드 20020,코멘트x
$reg_conf_yn_2 = '20020';
$reg_conf_yn_info_2 = '';
} else { // 모바일v2일땐 일반 불일치코드,코멘트=파일 오첨부
$reg_conf_yn_info_2 = '파일 오첨부';
}
}
}
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', $reg_conf_yn_2, $reg_conf_yn_info_2);
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', $reg_conf_yn_3, $reg_conf_yn_info_3);
//memo 저장
$this->model->saveMemo([$memo, $atcl_vr_sq]);
//실소유주 확인 저장
$this->model->update_owner_verifiable($atcl_vr_sq, $owner_verifiable);
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
//이미지 파일 없음 && 홍보확인서 V2일 경우
log_message('debug', '705 noimage_chk_chk sendData_return1 => ' . $sendData['atclNo'] . ' ::: ' . json_encode($sendData) . PHP_EOL);
if ($noimg_chk_chk == "Y" && $sendData['vrfcType'] == "D2") {
// $sendData['ownerVerifiable'] = false;
}
$d_yn = $this->m710_model->get_send_yn('D');
if ($d_yn['stop_yn'] == 'N') { //전송금지
//1.해당매물정보를v2_stop_api_save_info에다 넣음
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'D', '');
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
//API 호출
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
}
if ($send_result['result'] == 'success') {
if ($chk_type == '1') {
//상태변경 TABLE INSERT : 등기부등본 확인완료 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '45', $toDay);
$chgVrfc45 = $this->model->chgStatVrfc($atcl_vr_sq, '45'); //v2_vrfc_req INSERT
$statFaxUp45 = $this->model->chgStatFax($atcl_vr_sq, '45'); //fax_imgs
//상태변경 TABLE INSERT : 검증완료 상태로 변경
$result_query8 = $this->model->chgStat($atcl_vr_sq, '60', $toDay);
$chgVrfc60 = $this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
$statFaxUp60 = $this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
// ★ 검증완료
//0.불일치 이력이 있는지 확인
$cnt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
if (empty($cnt)) { //검증완료일땐 불일치가없어야 통계포함된다
if ($atcl_vrtc_type == 'M' || $atcl_vrtc_type == 'O') { //모바일은 등기가 첨 시작이니까 insert해줘야함
if (!($atcl_vrtc_type == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.검증완료시간
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '76', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '80', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0111', '1', 'add'); // 등기소로 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '86', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0107', '1', 'add'); // 리얼탑 열람 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '87', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0108', '1', 'add'); // 리얼탑 기열람 일치으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
}
} else {
if ($atcl_vrtc_type == 'M') {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//v2_vrfc_req try_cnt 값을 1로 update
$res_try = $this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$result_query9 = $this->model->chgStat($atcl_vr_sq, '69', $toDay);
$chgVrfc69 = $this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$statFaxUp69 = $this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일이고 검증실패
if (!in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03'))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//등기부등본 확인중 상태로 변경.
$result_query30 = $this->model->saveChangedHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 49 => 30'); //검증결과 변동사항 HISTORY
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
$statFaxUp40 = $this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
if ($try_cnt == '1') {
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '1');
if ($atcl_vrtc_type == 'T') {
//검증구분이 전화매물일 경우 사전에 일치로 처리된 값을 초기화 시켜준다.
$this->model->resetTelConf($atcl_vr_sq);
}
// ★1차실패
if ($atcl_vrtc_type == 'O') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$sf = 'F';
$model415->update_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $sf);
}
} else if ($try_cnt == '2') {
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일 이외 검증실패
if ($atcl_vrtc_type == 'O') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '77', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '85', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0112', '1', 'add'); // 등기소 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '88', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0109', '1', 'add'); // 리얼탑 열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '89', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0110', '1', 'add'); // 리얼탑 기열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
}
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
}
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 다음매물 확인
public function getNextInfo()
{

View File

@@ -2,8 +2,12 @@
namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M706Model;
use App\Models\v2\M710Model;
use Exception;
class M706 extends BaseController
{
@@ -110,9 +114,10 @@ class M706 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -124,6 +129,15 @@ class M706 extends BaseController
$memo = $this->model->getMemo($id);
$history = $this->model->getHistory($id);
$complexList = [];
$ptpList = [];
// 아파트단지목록
$complexList = $naver->complexList($data['address_code']);
// 평형목록
$ptpList = $naver->ptpList($data['hscp_no']);
$this->data['codes'] = $codes;
$this->data['regist'] = $regist;
$this->data['record'] = $record;
@@ -132,8 +146,477 @@ class M706 extends BaseController
$this->data['memo'] = $memo;
$this->data['history'] = $history;
$this->data['complexList'] = $complexList;
$this->data['ptpList'] = $ptpList;
return view("pages/v2/m706/detail", $this->data);
}
// 매물정보 수정
public function modifyInfo()
{
$naver = new NaverApiClient();
try {
$atcl_vr_sq = $this->request->getPost('rcpt_key'); //순번
$atcl_hscp_nm = $this->request->getPost('atcl_hscp_nm'); //단지명
$atcl_ptp_nm = $this->request->getPost('atcl_ptp_nm'); //평형명
$atcl_vrfc_type = $this->request->getPost('atcl_vrtc_way'); //검증구분
$trade_type = $this->request->getPost('trade_type_cd'); //거래구분
$atcl_addr1 = $this->request->getPost('atcl_addr1'); //상세주소1 폐기예정
$atcl_addr1a = $this->request->getPost('atcl_addr1a'); // 리 주소
$atcl_addr1b = $this->request->getPost('atcl_addr1b'); // 공동 : 동 주소, 비공동 : 지번주소
$atcl_addr2 = $this->request->getPost('atcl_addr2'); //상세주소2
$atcl_hscp_no = $this->request->getPost('atcl_hscp_no'); //단지번호
$atcl_ptp_no = $this->request->getPost('atcl_ptp_no'); //단지명
$atcl_amt1 = $this->request->getPost('atcl_amt1');
$atcl_amt2 = $this->request->getPost('atcl_amt2');
$atcl_amt3 = $this->request->getPost('atcl_amt3');
$atcl_floor = $this->request->getPost('atcl_floor');
$atcl_floor2 = $this->request->getPost('atcl_floor2'); // 총층
$return = '';
if ($trade_type == 'A1') {
$return = limitHscpMarketPriceInfo($this, $trade_type, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1);
} elseif ($trade_type == 'B1') {
$return = limitHscpMarketPriceInfo($this, $trade_type, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt2);
}
if (empty($return)) {
$result = $this->model->saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2);
$this->model->saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type);
if ($result['error_number'] != 0) {
throw new \Exception($result['error_message']);
} else {
//API 호출
$resultData = $this->model->getDetail($atcl_vr_sq);
$modifyInfo = $naver->modifyInfo(
$resultData['data']['atcl_no'],
$resultData['data']['hscp_no'],
$resultData['data']['ptp_no'],
$resultData['data']['bild_nm'],
$resultData['data']['rm_no'],
$resultData['data']['trade_type_cd'],
$resultData['data']['deal_amt'],
$resultData['data']['wrrnt_amt'],
$resultData['data']['lease_amt'],
$resultData['data']['isale_amt'],
$resultData['data']['prem_amt'],
$resultData['data']['floor'],
$resultData['data']['floor2'],
$resultData['data']['charger'],
$resultData['data']['address_code'],
$resultData['data']['address2'],
$resultData['data']['address2a'],
$resultData['data']['address2b'],
$resultData['data']['address3'],
$resultData['data']['sply_spc'],
$resultData['data']['excls_spc'],
$resultData['data']['tot_spc'],
$resultData['data']['grnd_spc'],
$resultData['data']['bldg_spc']
);
if ($modifyInfo['result'] != 'success') { //결과값 확인
$return = $modifyInfo['error'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $modifyInfo['error']['code'], $modifyInfo['error']['message'], $err_time, $resultData['data']['atcl_no']);
}
}
return $this->response->setJSON(body: [
'code' => '0',
'msg' => '정상적으로 저장되었습니다.',
]);
}
} catch (\Exception $e) {
return $this->response->setJSON(body: [
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 서류확인정보 저장
public function saveDocu()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 전화(서류)확인중 상태로 변경. (수정변경이력 저장)
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 확인여부 + 홍보확인서 미확인여부 상세, 매물주소, 가격거래구분, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 전화(서류)확인완료 상태. (수정변경이력 저장)
*/
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s'); //오늘날짜
$atcl_vrtc_way = $this->request->getPost('atcl_vrtc_way');
$atcl_vr_sq = $this->request->getPost('rcpt_key');
$arr = $this->request->getPost('chTotal');
$fax_conf_res_d11 = $this->request->getPost('fax_conf_res_d11');
$fax_conf_yn_1 = $this->request->getPost('fax_conf_yn_1');
$fax_conf_yn_2 = $this->request->getPost('fax_conf_yn_2');
$fax_conf_yn_3 = $this->request->getPost('fax_conf_yn_3');
$fax_conf_yn_4 = $this->request->getPost('fax_conf_yn_4');
$fax_conf_yn_info_2 = $this->request->getPost('fax_conf_yn_info_2');
$fax_conf_yn_info_3 = $this->request->getPost('fax_conf_yn_info_3');
$fax_conf_yn_info_4 = $this->request->getPost('fax_conf_yn_info_4');
$reg_chk_val = $this->request->getPost('reg_chk_val');
$memo = $this->request->getPost('memo_fax');
$try_cnt = '0';
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
if ((int) $resStat['stat_cd'] >= 40 || (int) $resStat['stat_cd'] == '190') {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$this->model->InsCharger($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
$resultCnt = $this->model->chkTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
if ($resultCnt['try_cnt'] == 0) { //1차 검증일 때
$try_cnt = '1';
} else if ($resultCnt['try_cnt'] == 1) { //2차 검증일 때
$try_cnt = '2';
} else {
$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, '');
if ($result == 0) { //v2_confirm 존재하지 않는다면
if ($fax_conf_yn_2 == '10000' && $fax_conf_yn_3 == '10000' && $fax_conf_yn_4 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($fax_conf_yn_2 == '10000' && $fax_conf_yn_3 == '10000' && $fax_conf_yn_4 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
}
$resUpdate = $this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
//상태변경 TABLE INSERT : 전화(서류)확인중 상태로 변경
$result_query2 = $this->model->chgStat($atcl_vr_sq, '30', $toDay);
$chgVrfc = $this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'D11', $fax_conf_res_d11, $arr);
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'D12', $fax_conf_yn_2, $fax_conf_yn_info_2);
//v2_check_list 가격거래구분 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'D13', $fax_conf_yn_3, $fax_conf_yn_info_3);
//v2_check_list 의뢰인정보 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, 'D14', $fax_conf_yn_4, $fax_conf_yn_info_4);
//memo 저장
if (!empty($memo)) {
$this->model->saveMemo([$memo, $usr_id, $atcl_vr_sq]);
}
//API 호출
$sendData = $this->model->getDataConfirmAPI($atcl_vr_sq);
if ($fax_conf_yn_4 == '10000' || (int) $try_cnt < 2) {
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
if ($send_result['result'] == 'success') { //HISTORY
if ($fax_conf_res_d11 == '10000' && $chk_type == '1') {
//상태변경 TABLE INSERT : 전화(서류)확인 완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '35', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '35'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '35'); //fax_imgs
if ($reg_chk_val == '1') {
//등기부등본 확인 대상은 전화(서류)확인 완료 후 -> 등기부등본 확인중 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '40', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '40'); //fax_imgs
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0201', '1', 'add'); // 일치로 저장
} else {
//등기부등본 확인 대상이 아닌 경우 전화(서류)확인 완료 후 -> 검증 완료 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0205', '1', 'add'); // 홍보확인서완료 등기부등본확인 안함 저장
}
} else {
//상태변경 TABLE INSERT : 전화(서류)확인 불일치
$this->model->chgStat($atcl_vr_sq, '39', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '39'); //fax_imgs
if ($try_cnt == '1') {
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgTryCnt($atcl_vr_sq, '1');
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0301', '1', 'add'); // 1차실패로 저장
} else if ($try_cnt == '2') {
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0302', '1', 'add'); // 2차실패로 저장
}
if ($fax_conf_res_d11 == '20013') {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0203', '1', 'add'); // 기타로 저장
} else {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0202', '1', 'add'); // 불일치로 저장
}
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
} else {
$this->model->chgStat($atcl_vr_sq, '39', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '39'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '39'); //fax_imgs
$this->model->saveChangedHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 39 => 30'); //검증결과 변동사항 HISTORY
$this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
throw new Exception('의뢰인정보 불일치로 저장되었습니다.');
}
return $this->response->setJSON(body: [
'code' => '0',
'msg' => '정상적으로 저장되었습니다.',
]);
}
} catch (\Exception $e) {
return $this->response->setJSON(body: [
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 등기부등본 정보 저장
public function saveRegi()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 등기부등본 확인중 상태로 변경. (수정변경이력 저장)
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 매물주소, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 등기부등본 확인완료 상태. (수정변경이력 저장)
*/
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$mode = $this->request->getGet('mode');
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s');
$atcl_vrtc_way = 'R';
$atcl_vr_sq = $this->request->getPost('rcpt_key');
$reg_conf_yn_1 = $this->request->getPost('reg_conf_yn_1');
$reg_conf_yn_2 = $this->request->getPost('reg_conf_yn_2');
$reg_conf_yn_3 = $this->request->getPost('reg_conf_yn_3');
$reg_conf_yn_info_2 = $this->request->getPost('reg_conf_yn_info_2');
$reg_conf_yn_info_3 = $this->request->getPost('reg_conf_yn_info_3');
$memo = $this->request->getPost('memo_reg');
$try_cnt = '0';
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $this->model->get_v2_vrfc_req($atcl_vr_sq);
if ((int) $resStat['stat_cd'] >= 60 || (int) $resStat['stat_cd'] == 19) {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$this->model->InsResChar($atcl_vr_sq); //담당자가 없을 경우 강제로 session 정보로 넣어준다
$resultCnt = $this->model->chkRegiTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
if ($resultCnt['reg_try_cnt'] == 0) { //1차 검증일 때
$try_cnt = '1';
} else if ($resultCnt['reg_try_cnt'] == 1) { //2차 검증일 때
$try_cnt = '2';
} else {
$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, $atcl_vrtc_way);
if ($result == 0) {
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
}
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
//상태변경 TABLE INSERT : 등기부등본 확인중 상태로 변경
$this->model->chgStat($atcl_vr_sq, '40', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '40'); //v2_vrfc_req INSERT
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', $reg_conf_yn_2, $reg_conf_yn_info_2);
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', $reg_conf_yn_3, $reg_conf_yn_info_3);
//memo 저장
if (!empty($memo)) {
$this->model->saveMemo([$memo, $atcl_vr_sq]);
}
//API 호출
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
if ($send_result['result'] == 'success') {
if ($chk_type == '1') {
//상태변경 TABLE INSERT : 등기부등본 확인완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '45', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '45'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '45'); //fax_imgs
//상태변경 TABLE INSERT : 검증완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
$v2_vrfc_req->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//등기부등본 확인중 상태로 변경.
$this->model->saveChangedHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 49 => 30'); //검증결과 변동사항 HISTORY
$this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
if ($try_cnt == '1') {
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '1');
} else if ($try_cnt == '2') {
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
}
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
return $this->response->setJSON(body: [
'code' => '0',
'msg' => '정상적으로 저장되었습니다.',
]);
}
} catch (\Exception $e) {
return $this->response->setJSON(body: [
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
}

View File

@@ -3,8 +3,12 @@ namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\Common;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M708Model;
use App\Models\v2\M710Model;
use Exception;
class M708 extends BaseController
{
@@ -118,9 +122,9 @@ class M708 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -129,7 +133,6 @@ class M708 extends BaseController
$data = $this->model->getDetail($id);
$memo = $this->model->getMemo($id);
$article = null;
$confirm = null;
if (!empty($data)) {
@@ -360,6 +363,11 @@ class M708 extends BaseController
// 확인결과 저장
public function saveResult()
{
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$fax_sq = $this->request->getPost('fax_sq');
$vr_sq = $this->request->getPost('vr_sq');
@@ -387,9 +395,72 @@ class M708 extends BaseController
}
// 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->model->saveHongBoFAX($fax_sq, $vr_sq, $atcl_no, $work_type, $send_yn, $result_d11 ?? null, $comment_d11 ?? null, $fax_conf_yn_1 ?? null, $fax_conf_yn_2 ?? null, $fax_conf_yn_3 ?? null, $fax_conf_info_1 ?? null, $fax_conf_info_2 ?? null, $fax_conf_info_3 ?? null, $file_type);
if (empty($return['code']) && $work_type == '2') {
// 검증센터에 데이터를 전송한다.
$sendData = $this->model->getDataConfirmAPI($vr_sq);
if (($fax_conf_yn_3 ?? 'N') == 'Y' || (int) $article['try_cnt'] < 1) {
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
if ($send_result['result'] == 'success') {
$this->model->InsCharger($vr_sq);
// DB에 상태값을 전송완료로 저장한다.
if (empty($sendData['success'])) {
$stat_cd = '39'; // 서류/전화 확인 실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경..
if ($sendData['try_cnt'] >= '1') {
$stat_cd = '69'; // 검증실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경..
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0302', '1', 'add'); // 최종실패로 저장
} else {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0301', '1', 'add'); // 1차실패로 저장
}
// $res_try = $this->m708_model->chgTryCnt($vr_sq, intval($sendData['try_cnt']) +1);
$this->model->increseTryCnt($vr_sq);
if (($result_d11 ?? '') == '20013') {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0203', '1', 'add'); // 기타로 저장
} else {
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0202', '1', 'add'); // 불일치로 저장
}
} else {
$stat_cd = '35'; // 서류/전화 확인 성공
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경..
$rgbk_cofirm = $this->model->getRgbk_confirm($vr_sq);
if ($rgbk_cofirm == '1') {
$stat_cd = '40';
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 등기부등본 확인중 상태로 변경..
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0201', '1', 'add'); // 일치로 저장
} else {
$stat_cd = '60';
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 검증완료 상태로 변경..
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0205', '1', 'add'); // 홍보확인서완료 등기부등본확인 안함 저장
}
}
} else {
throw new \Exception($send_result['error']);
}
} else {
$stat_cd = '39'; // 서류/전화 확인 실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd);
$stat_cd = '30'; // 서류/전화 확인 중
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd);
$this->model->increseTryCnt($vr_sq);
throw new \Exception('의뢰인 정보 불일치로 저장되었습니다.');
}
}
return $this->response->setJSON([
@@ -408,14 +479,131 @@ class M708 extends BaseController
}
}
// 분양계약서 저장
// 분양계약서 조회
public function saveBunyangCnt()
{
try {
$vr_sq = $this->request->getPost('vr_sq');
$rsrv_sq = $this->model->get_rsrv_sq($vr_sq);
$cnt = $this->model->getI8Cnt($rsrv_sq['rsrv_sq']);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
'cnt' => $cnt,
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 분양계약서 저장
public function saveResult3()
{
$naver = new NaverApiClient();
$v2StDailyModel = new V2StDailyModel();
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');
$resyn = $this->request->getPost('resYn');
$dbusageagryn = $this->request->getPost('dbUsageAgrYn');
$send_yn = 'Y'; // 업데이트 된다면 미처리->처리상태로 변경
$article = $this->model->getArticleInfo2($atcl_no, $vr_sq);
$v2_vrfc_req = $v2StDailyModel->get_v2_vrfc_req($vr_sq);
if ((int) $article['stat_cd'] >= 40) {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
if (!empty($resyn)) {
$this->model->updateResDB($resyn, $dbusageagryn, $vr_sq);
}
// DB에 결과를 저장한다.
$return = $this->model->saveresult3FAX($fax_sq, $vr_sq, $atcl_no, $work_type, $send_yn, $result_d11 ?? null, $comment_d11 ?? null, $fax_conf_yn_1 ?? null, $fax_conf_yn_2 ?? null, $fax_conf_yn_3 ?? null, $fax_conf_info_1 ?? null, $fax_conf_info_2 ?? null, $fax_conf_info_3 ?? null);
if (empty($return['code']) && $work_type == '2') {
// 검증센터에 데이터를 전송한다.
$sendData = $this->model->getDataConfirmAPI($vr_sq);
if (($fax_conf_yn_3 ?? 'N') == 'Y' || $article['try_cnt'] < '1') {
$send_result = $naver->confirm($sendData['atclNo'], $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['modifyInfo'], $sendData['date']);
if ($send_result['result'] == 'success') {
$this->model->InsCharger($vr_sq);
// DB에 상태값을 전송완료로 저장한다.
if (empty($sendData['success'])) {
$stat_cd = '39'; // 서류/전화 확인 실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경
if ($sendData['try_cnt'] >= '1') {
$stat_cd = '69'; // 검증실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경..
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0302', '1', 'add'); // 최종실패로 저장
} else {
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0301', '1', 'add'); // 1차실패로 저장
}
// $res_try = $this->m708_model->chgTryCnt($vr_sq, intval($sendData['try_cnt']) +1);
$this->model->increseTryCnt($vr_sq);
if (($result_d11 ?? '') == '20013') {
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0203', '1', 'add'); // 기타로 저장
} else {
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0202', '1', 'add'); // 불일치로 저장
}
} else {
$stat_cd = '35'; // 서류/전화 확인 성공
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 전송완료 상태로 변경..
$rgbk_cofirm = $this->model->getRgbk_confirm($vr_sq);
if ($rgbk_cofirm == '1') {
$stat_cd = '40';
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 등기부등본 확인중 상태로 변경..
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0201', '1', 'add'); // 일치로 저장
} else {
$stat_cd = '60';
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd); // 검증완료 상태로 변경..
$v2StDailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'D0205', '1', 'add'); // 홍보확인서완료 등기부등본확인 안함 저장
}
}
} else {
throw new \Exception($send_result['error']);
}
} else {
$stat_cd = '39'; // 서류/전화 확인 실패
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd);
$stat_cd = '30'; // 서류/전화 확인 중
$this->model->saveChangeStep($fax_sq, $vr_sq, $stat_cd);
$this->model->increseTryCnt($vr_sq);
throw new \Exception('의뢰인 정보 불일치로 저장되었습니다.');
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
}
} catch (\Exception $e) {
return $this->response->setJSON([

View File

@@ -117,9 +117,9 @@ class M709 extends BaseController
// 상세화면
public function detail($id)
{
$id = (int) $id;
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}

View File

@@ -4,7 +4,9 @@ namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\Common;
use App\Libraries\MyUpload;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M712Model;
class M712 extends BaseController
@@ -124,9 +126,10 @@ class M712 extends BaseController
public function detail($id): string
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -139,12 +142,37 @@ class M712 extends BaseController
$regist = $this->model->getRecordInfo($id, '2'); //등기부등본
$display = $this->model->getDisplay('M705_detail');
$hscp_info = [];
if (!empty($data['hscp_no'])) {
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
$villa_rlet_type_cd = ['A05', 'A06'];
if (in_array($data['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
$detail_hscp = $naver->aptDetail($data['hscp_no']);
}
if (in_array($data['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
$detail_hscp = $naver->villaDetail($data['hscp_no']);
}
// print_r($data);
// print_r($detail_hscp);
// exit;
if (!empty($detail_hscp) && isset($detail_hscp['result'])) {
$hscp_info = $detail_hscp['result'];
}
}
$this->data['codes'] = $codes;
$this->data['data'] = $data;
$this->data['memo'] = $memo;
$this->data['record'] = $record;
$this->data['regist'] = $regist;
$this->data['display'] = $display;
$this->data['hscp_info'] = $hscp_info;
return view("pages/v2/m712/detail", $this->data);
}
@@ -294,13 +322,383 @@ class M712 extends BaseController
// 정보저장
public function saveRegi()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 등기부등본 확인중 상태로 변경. (수정변경이력 저장)
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 매물주소, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 등기부등본 확인완료 상태. (수정변경이력 저장)
1.12.1 서류 확인내용 v2_article_info_etc document_cert_method 저장
*/
$naver = new NaverApiClient();
// $model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s');
$atcl_vrtc_way = 'R'; //검증구분
$atcl_vr_sq = $this->request->getPost('rcpt_key');
// $atcl_no = $this->request->getPost('atcl_no');
$reg_conf_yn_1 = $this->request->getPost('reg_conf_yn_1'); //확인내용
$reg_conf_yn_2 = $this->request->getPost('reg_conf_yn_2'); //매물주소
$reg_conf_yn_3 = $this->request->getPost('reg_conf_yn_3'); //의뢰인정보
$reg_conf_yn_info_2 = $this->request->getPost('reg_conf_yn_info_2'); //매물주소
$reg_conf_yn_info_3 = $this->request->getPost('reg_conf_yn_info_3'); //의뢰인정보
$memo = $this->request->getPost('memo'); //메모
$owner_verifiable = $this->request->getPost('owner_verifiable'); //실소유주 확인여부
$noimg_chk_chk = $this->request->getPost('noimg_chk_chk'); // 등기부등본이미지 파일없음.
$img_chk_chk = $this->request->getPost('img_chk_chk'); // 등기소, 리얼탑 열람, 리얼탑 기열람, 열람
$atcl_vrtc_type = $this->request->getPost('atcl_vrtc_type'); // 검증구분
$vrfc_type_sub = $this->request->getPost('vrfc_type_sub'); // 하위검증구분
$arr_uncnfrm_status = $this->request->getPost('arr_uncnfrm_status'); // 등기부등본 미확인여부 상세
$ownerTypeCode = $this->request->getPost('ownerTypeCode'); // 소유자명 확인 일치 , 불일치
$document_cert_method = $this->request->getPost('document_cert_method'); // 서류 내용 확인
if ($owner_verifiable == "1") {
$owner_verifiable = true;
} else {
$owner_verifiable = false;
}
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
if ((int) $resStat['stat_cd'] >= 60 || (int) $resStat['stat_cd'] == 19) {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$resultCnt = $this->model->chkRegiTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
if ($resultCnt['reg_try_cnt'] == 0) { // 1차 검증일 때
log_message('debug', '712 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 0 ');
$try_cnt = '1';
} else if ($resultCnt['reg_try_cnt'] == 1) { // 2차 검증일 때
log_message('debug', '712 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 1 ');
$try_cnt = '2';
} else {
log_message('debug', '712 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 예외처리 ');
$try_cnt = '2';
//$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, $atcl_vrtc_way);
if ($result == 0) { //v2_confirm 존재하지 않는다면
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
// 수정한 시간이 현재시간10분전 보다 클 경우 수정불가능
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
$this->model->InsResChar($atcl_vr_sq); //담당자 업데이트
// 모바일v1,v2고 등기부등본 미확인여부 상세 저장
if ($vrfc_type_sub == 'M1' || $vrfc_type_sub == 'O1') {
$this->model->add_cert_uncnfrm_status($atcl_vr_sq, $arr_uncnfrm_status);
if (strpos($arr_uncnfrm_status, '20020') !== false) { //등기부등본 미확인여부 상세에 20020(파일 오첨부)있고
if ($vrfc_type_sub == 'M1') { // 모바일v1일땐 코드 20020,코멘트x
$reg_conf_yn_2 = '20020';
$reg_conf_yn_info_2 = '';
} else { // 모바일v2일땐 일반 불일치코드,코멘트=파일 오첨부
$reg_conf_yn_info_2 = '파일 오첨부';
}
}
}
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', $reg_conf_yn_2, $reg_conf_yn_info_2);
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', $reg_conf_yn_3, $reg_conf_yn_info_3);
//memo 저장
$this->model->saveMemo([$memo, $atcl_vr_sq]);
// document_cert_method
$this->model->updatedocument_cert_method($atcl_vr_sq, $document_cert_method);
//실소유주 확인 저장
$this->model->update_owner_verifiable($atcl_vr_sq, $owner_verifiable);
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
log_message('debug', '712 saveRegi => ' . $sendData['atclNo'] . ' ::: ' . json_encode($sendData) . PHP_EOL);
$d_yn = $this->model->get_send_yn('D');
if ($d_yn['stop_yn'] == 'N') { //전송금지
//1.해당매물정보를v2_stop_api_save_info에다 넣음
$this->model->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'D', '');
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
//API 호출
$send_result = $naver->certification_712($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
}
if ($send_result['result'] == 'success') {
if ($chk_type == '1') {
//상태변경 TABLE INSERT : 등기부등본 확인완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '45', $toDay);
$chgVrfc45 = $this->model->chgStatVrfc($atcl_vr_sq, '45'); //v2_vrfc_req INSERT
$statFaxUp45 = $this->model->chgStatFax($atcl_vr_sq, '45'); //fax_imgs
//상태변경 TABLE INSERT : 검증완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
$chgVrfc60 = $this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
$statFaxUp60 = $this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
// ★ 검증완료
//0.불일치 이력이 있는지 확인
$cnt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
if (empty($cnt)) {
if ($atcl_vrtc_type == 'M' || $atcl_vrtc_type == 'N') { //모바일은 등기가 첨 시작이니까 insert해줘야함
if (!($atcl_vrtc_type == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.검증완료시간
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '76', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '80', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0111', '1', 'add'); // 등기소로 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '86', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0107', '1', 'add'); // 리얼탑 열람 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '87', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0108', '1', 'add'); // 리얼탑 기열람 일치으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
}
} else {
if ($atcl_vrtc_type == 'M') {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$chgVrfc69 = $this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$statFaxUp69 = $this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일이고 검증실패
if (!in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03'))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//등기부등본 확인중 상태로 변경.
$this->model->saveChangedHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 49 => 30'); //검증결과 변동사항 HISTORY
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
$statFaxUp40 = $this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
if ($try_cnt == '1') {
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '1');
if ($atcl_vrtc_type == 'T') {
//검증구분이 전화매물일 경우 사전에 일치로 처리된 값을 초기화 시켜준다.
$reset_query = $this->model->resetTelConf($atcl_vr_sq);
}
// ★1차실패
if ($atcl_vrtc_type == 'N') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$sf = 'F';
$model415->update_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $sf);
}
} else if ($try_cnt == '2') {
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$this->model->chgStat($atcl_vr_sq, '69', $toDay);
$chgVrfc69 = $this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$statFaxUp69 = $this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일 이외 검증실패
if ($atcl_vrtc_type == 'N') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '77', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '85', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0112', '1', 'add'); // 등기소 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '88', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0109', '1', 'add'); // 리얼탑 열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '89', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0110', '1', 'add'); // 리얼탑 기열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
}
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success',
]);
} catch (\Exception $e) {
return $this->response->setJSON([

View File

@@ -3,7 +3,10 @@ namespace App\Controllers\V2;
use App\Controllers\BaseController;
use App\Libraries\MyUpload;
use App\Libraries\NaverApiClient;
use App\Models\common\CodeModel;
use App\Models\results\M415Model;
use App\Models\v2\M710Model;
use App\Models\v2\M713Model;
class M713 extends BaseController
@@ -121,9 +124,10 @@ class M713 extends BaseController
// 상세화면
public function detail($id): string
{
$id = (int) $id;
$naver = new NaverApiClient();
$id = (string) $id;
if ($id <= 0) {
if ($id === '') {
throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
}
@@ -138,6 +142,30 @@ class M713 extends BaseController
$sido = $this->model->getAreaList(); // 지역조회
$hscp_info = [];
if (!empty($data['hscp_no'])) {
$apt_rlet_type_cd = ['A01', 'A02', 'A03', 'A04', 'B01', 'B02', 'B03'];
$villa_rlet_type_cd = ['A05', 'A06'];
if (in_array($data['rlet_type_cd'], $apt_rlet_type_cd)) { // apt 단지
$detail_hscp = $naver->aptDetail($data['hscp_no']);
}
if (in_array($data['rlet_type_cd'], $villa_rlet_type_cd)) { // villa 단지
$detail_hscp = $naver->villaDetail($data['hscp_no']);
}
// print_r($data);
// print_r($detail_hscp);
// exit;
if (!empty($detail_hscp) && isset($detail_hscp['result'])) {
$hscp_info = $detail_hscp['result'];
}
}
$this->data['codes'] = $codes;
$this->data['data'] = $data;
$this->data['memo'] = $memo;
@@ -145,6 +173,7 @@ class M713 extends BaseController
$this->data['regist'] = $regist;
$this->data['display'] = $display;
$this->data['sido'] = $sido;
$this->data['hscp_info'] = $hscp_info;
return view("pages/v2/m713/detail", $this->data);
}
@@ -293,6 +322,414 @@ class M713 extends BaseController
}
public function saveModify()
{
try {
$vr_sq = $this->request->getPost('vr_sq');
$owner_birth = $this->request->getPost('owner_birth');
$address2 = $this->request->getPost('address2');
$address2a = $this->request->getPost('address2a');
$address2b = $this->request->getPost('address2b');
$address3 = $this->request->getPost('address3');
$address4 = $this->request->getPost('address4');
$address_code = $this->request->getPost('dong');
$hscp_no = $this->request->getPost('hscp_no');
$hscp_nm = $this->request->getPost('hscp_nm');
$owner_birth = trim($owner_birth);
$this->model->modify_info($vr_sq, $owner_birth, $address2, $address2a, $address2b, $address3, $address4, $address_code, $hscp_no, $hscp_nm);
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 등기부등본 저장
public function saveRegi()
{
/*
1.0.1 POST 데이터 받기.
1.1.1 1차 검증인지 2차검증인지 확인.
1.1.2 1차, 2차 검증이면 v2_confirm.type에 넣을 값을 알맞게 셋팅.
1.2.1 v2_confirms에 데이터가 있는지 확인.
1.3.1 데이터가 있음 : success 여부 판단 후 updateConfirm 실행 success값만 UPDATE. (수정변경이력 저장)
1.4.1 데이터가 없음 : success 여부 판단 후 insertConfirm 실행 v2_confirms INSERT. (수정변경이력 저장)
1.4.2 상태변경 하기 : 등기부등본 확인중 상태로 변경. (수정변경이력 저장)
1.5.1 이미지파일 서버에 UPLOAD (수정변경이력 저장)
1.6.1 기존파일 탐색.
1.7.1 기존파일 있음 : 기존파일 use_yn 'N'으로 UPDATE 후 v2_files INSERT.
1.8.1 기존파일 없음 : v2_files INSERT.
1.9.1 매물주소, 의뢰인 정보 v2_check_list INSERT. (수정변경이력 저장)
1.10.1 API 전송.
1.11.1 API 전송결과 : SUCCESS 이면 상태값 변경 : 등기부등본 확인완료 상태. (수정변경이력 저장)
*/
$naver = new NaverApiClient();
$model710 = new M710Model();
$model415 = new M415Model();
$v2DailyModel = new V2StDailyModel();
try {
$usr_id = session('usr_id');
$toDay = date('Y-m-d H:i:s');
$atcl_vrtc_way = 'R'; //검증구분
$atcl_vr_sq = $this->request->getPost('rcpt_key');
// $atcl_no = $this->request->getPost('atcl_no');
$reg_conf_yn_1 = $this->request->getPost('reg_conf_yn_1'); //확인내용
$reg_conf_yn_2 = $this->request->getPost('reg_conf_yn_2'); //매물주소
$reg_conf_yn_3 = $this->request->getPost('reg_conf_yn_3'); //의뢰인정보
$reg_conf_yn_info_2 = $this->request->getPost('reg_conf_yn_info_2'); //매물주소
$reg_conf_yn_info_3 = $this->request->getPost('reg_conf_yn_info_3'); //의뢰인정보
$memo = $this->request->getPost('memo'); //메모
$owner_verifiable = $this->request->getPost('owner_verifiable'); //실소유주 확인여부
$noimg_chk_chk = $this->request->getPost('noimg_chk_chk'); // 등기부등본이미지 파일없음.
$img_chk_chk = $this->request->getPost('img_chk_chk'); // 등기소, 리얼탑 열람, 리얼탑 기열람, 열람
$atcl_vrtc_type = $this->request->getPost('atcl_vrtc_type'); // 검증구분
$vrfc_type_sub = $this->request->getPost('vrfc_type_sub'); // 하위검증구분
$arr_uncnfrm_status = $this->request->getPost('arr_uncnfrm_status'); // 등기부등본 미확인여부 상세
//상태가 이미 등기부등본확인중 이상이면 저장하지 않는다.
$resStat = $this->model->chkStat($atcl_vr_sq);
$v2_vrfc_req = $v2DailyModel->get_v2_vrfc_req($atcl_vr_sq);
$rlet_type_cd = $model415->get_rlet_type_cd($atcl_vr_sq);
if ((int) $resStat['stat_cd'] >= 60 || (int) $resStat['stat_cd'] == 19) {
throw new \Exception('이미 저장된 데이터입니다.');
} else {
$resultCnt = $this->model->chkRegiTryCnt($atcl_vr_sq); //1차검증인지 2차검증인지 확인 쿼리 : v2_vrfc_req.type_cnt
if ($resultCnt['reg_try_cnt'] == 0) { // 1차 검증일 때
log_message('debug', '713 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 0 ');
$try_cnt = '1';
} else if ($resultCnt['reg_try_cnt'] == 1) { // 2차 검증일 때
log_message('debug', '713 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 1 ');
$try_cnt = '2';
} else {
log_message('debug', '713 page >> 매물번호 : ' . $atcl_vr_sq . ' 등기부등본 불일치 횟수 : 예외처리 ');
$try_cnt = '2';
//$try_cnt = intval($try_cnt) + 1;
}
$result = $this->model->chkConfirm($atcl_vr_sq, $atcl_vrtc_way);
if ($result == 0) { //v2_confirm 존재하지 않는다면
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
// 수정한 시간이 현재시간10분전 보다 클 경우 수정불가능
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->insertConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type, $try_cnt);
} else {
if ($reg_conf_yn_2 == '10000' && $reg_conf_yn_3 == '10000') { //success 여부 판단
$chk_type = '1';
//$chk_delay = '0'; //지연여부
//$chk_zombie = '0'; //좀비매물
} else {
// 2015.06.29 추가
// 불일치가 날 경우에 10분 이내에 다시 불일치 처리 불가능(같은 매물을 두사람이 중복처리할 가능성 사전 방지)
// 1. 현재 매물의 마지막으로 업데이트 된 시간을 가져옴.
// 2. 현재 시간과 비교하여 10분 이내면 경고창을 띄어줌.
$chk_type = '0';
//$chk_delay = '1'; //지연여부
//$chk_zombie = '0'; //좀비매물
$result_tm = $this->model->getUpdateFailTime($atcl_vr_sq);
$update_tm = $result_tm['insert_tm'];
$ten_ago = date("Y-m-d H:i:s", mktime(date("H"), date("i") - 1, date("s"), date("m"), date("d"), date("Y")));
if ($update_tm > $ten_ago) {
// 수정한 시간이 현재시간10분전 보다 클 경우 수정불가능
throw new \Exception('이미 불일치 처리 된 매물입니다.');
}
}
$this->model->updateConfirm($atcl_vr_sq, $atcl_vrtc_way, $chk_type);
}
$this->model->InsResChar($atcl_vr_sq); //담당자 업데이트
// 모바일v1,v2고 등기부등본 미확인여부 상세 저장
if ($vrfc_type_sub == 'M1' || $vrfc_type_sub == 'O1') {
$this->model->add_cert_uncnfrm_status($atcl_vr_sq, $arr_uncnfrm_status);
if (strpos($arr_uncnfrm_status, '20020') !== false) { //등기부등본 미확인여부 상세에 20020(파일 오첨부)있고
if ($vrfc_type_sub == 'M1') { // 모바일v1일땐 코드 20020,코멘트x
$reg_conf_yn_2 = '20020';
$reg_conf_yn_info_2 = '';
} else { // 모바일v2일땐 일반 불일치코드,코멘트=파일 오첨부
$reg_conf_yn_info_2 = '파일 오첨부';
}
}
}
//v2_check_list 확인여부 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '21', $reg_conf_yn_2, $reg_conf_yn_info_2);
//v2_check_list 매물주소 INSERT
$this->model->insertChkList($atcl_vr_sq, $atcl_vrtc_way, '22', $reg_conf_yn_3, $reg_conf_yn_info_3);
//memo 저장
$this->model->saveMemo([$memo, $atcl_vr_sq]);
//실소유주 확인 저장
$this->model->update_owner_verifiable($atcl_vr_sq, $owner_verifiable);
$sendData = $this->model->getDatacertAPI($atcl_vr_sq, 'R');
//이미지 파일 없음 && 홍보확인서 V2일 경우
log_message('debug', '713 noimage_chk_chk sendData_return1 => ' . $sendData['atclNo'] . ' ::: ' . json_encode($sendData) . PHP_EOL);
if ($noimg_chk_chk == "Y" && $sendData['vrfcType'] == "D2") {
// $sendData['ownerVerifiable'] = false;
}
$d_yn = $model710->get_send_yn('O');
if ($d_yn['stop_yn'] == 'N') { //전송금지
//1.해당매물정보를v2_stop_api_save_info에다 넣음
$model710->insert_v2_stop_api_save_info($sendData['atclNo'], $atcl_vr_sq, 'O', '');
//2.아무렇지않게 행동한다
$send_result['result'] = 'success';
} else {
//API 호출
$send_result = $naver->certification($sendData['atclNo'], $try_cnt, $sendData['success'], $sendData['checkList'], $sendData['charger'], $sendData['date'], $sendData['modifyInfo'], $sendData['ownerVerifiable']);
}
if ($send_result['result'] == 'success') {
if ($chk_type == '1') {
//상태변경 TABLE INSERT : 등기부등본 확인완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '45', $toDay);
$chgVrfc45 = $this->model->chgStatVrfc($atcl_vr_sq, '45'); //v2_vrfc_req INSERT
$statFaxUp45 = $this->model->chgStatFax($atcl_vr_sq, '45'); //fax_imgs
//상태변경 TABLE INSERT : 검증완료 상태로 변경
$this->model->chgStat($atcl_vr_sq, '60', $toDay);
$chgVrfc60 = $this->model->chgStatVrfc($atcl_vr_sq, '60'); //v2_vrfc_req INSERT
$statFaxUp60 = $this->model->chgStatFax($atcl_vr_sq, '60'); //fax_imgs
// ★ 검증완료
//0.불일치 이력이 있는지 확인
$cnt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
if (empty($cnt)) { //검증완료일땐 불일치가없어야 통계포함된다
if ($atcl_vrtc_type == 'M' || $atcl_vrtc_type == 'O') { //모바일은 등기가 첨 시작이니까 insert해줘야함
if (!($atcl_vrtc_type == 'M' && in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03')))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.검증완료시간
$finishTime = $model415->get_60_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인완료 시간
$cert_comple_dt = $model415->get_cert_confTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '76', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '80', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0111', '1', 'add'); // 등기소로 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '86', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0107', '1', 'add'); // 리얼탑 열람 일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '87', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0108', '1', 'add'); // 리얼탑 기열람 일치으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0101', '1', 'add'); // 일치로 저장
}
} else {
if ($atcl_vrtc_type == 'M') {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//v2_vrfc_req try_cnt 값을 1로 update
$res_try = $this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$result_query9 = $this->model->chgStat($atcl_vr_sq, '69', $toDay);
$chgVrfc69 = $this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$statFaxUp69 = $this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일이고 검증실패
if (!in_array($rlet_type_cd['rlet_type_cd'], array('B01', 'B02', 'B03'))) {//만약 분양권들이면 넘어가고 아니면 체크
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
}
} else {
//상태변경 TABLE INSERT : 등기부등본 확인 불일치 상태로 변경
$result_query7 = $this->model->chgStat($atcl_vr_sq, '49', $toDay);
$chgVrfc49 = $this->model->chgStatVrfc($atcl_vr_sq, '49'); //v2_vrfc_req INSERT
$statFaxUp49 = $this->model->chgStatFax($atcl_vr_sq, '49'); //fax_imgs
//등기부등본 확인중 상태로 변경.
$this->model->saveChangedHistory($atcl_vr_sq, '30', 'C9', $usr_id, '상태변경 : 49 => 30'); //검증결과 변동사항 HISTORY
$chgVrfc40 = $this->model->chgStatVrfc($atcl_vr_sq, '30'); //v2_vrfc_req INSERT
$statFaxUp40 = $this->model->chgStatFax($atcl_vr_sq, '30'); //fax_imgs
if ($try_cnt == '1') {
//v2_vrfc_req try_cnt 값을 1로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '1');
if ($atcl_vrtc_type == 'T') {
//검증구분이 전화매물일 경우 사전에 일치로 처리된 값을 초기화 시켜준다.
$reset_query = $this->model->resetTelConf($atcl_vr_sq);
}
// ★1차실패
if ($atcl_vrtc_type == 'O') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$sf = 'F';
$model415->update_v2_time_required_Conf($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $sf);
}
} else if ($try_cnt == '2') {
//v2_vrfc_req try_cnt 값을 2로 update
$this->model->chgRegiTryCnt($atcl_vr_sq, '2');
//상태변경 TABLE INSERT : 검증실패 상태로 변경.
$result_query9 = $this->model->chgStat($atcl_vr_sq, '69', $toDay);
$chgVrfc69 = $this->model->chgStatVrfc($atcl_vr_sq, '69'); //v2_vrfc_req INSERT
$statFaxUp69 = $this->model->chgStatFax($atcl_vr_sq, '69'); //fax_imgs
// ★모바일 이외 검증실패
if ($atcl_vrtc_type == 'O') {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_M_timeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.검증실패시간
$finishTime = $model415->get_69_ForHistory($atcl_vr_sq);
//4.해당 정보를 테이블에 넣는다
$model415->insert_v2_time_required_M($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm'], $finishTime['insert_tm']);
} else {
//1.등기부등본 확인중 시간
$tel_doc_conf_dt = $model415->get_cert_ing_TimeForHistory($atcl_vr_sq);
//2.등기부등본 확인실패 시간
$cert_comple_dt = $model415->get_cert_failTimeForHistory($atcl_vr_sq);
//3.해당 정보를 테이블에 넣는다
$model415->update_v2_time_required_Conf_Done($v2_vrfc_req['atcl_no'], $v2_vrfc_req['cpid'], $atcl_vrtc_type, $tel_doc_conf_dt['insert_tm'], $cert_comple_dt['insert_tm']);
}
}
}
if ($noimg_chk_chk == 'Y') {
$this->model->chgStat($atcl_vr_sq, '70', $toDay);
$this->model->updateStat($atcl_vr_sq, 'Y'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0103', '1', 'add'); // 등기부등본이미지 없음 저장
}
if ($img_chk_chk == 'O') {
$this->model->chgStat($atcl_vr_sq, '77', $toDay);
$this->model->updateStat($atcl_vr_sq, 'O'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0105', '1', 'add'); // (열람)간소화확인으로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'T') {
$this->model->chgStat($atcl_vr_sq, '85', $toDay);
$this->model->updateStat($atcl_vr_sq, 'T'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0112', '1', 'add'); // 등기소 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'R') {
$this->model->chgStat($atcl_vr_sq, '88', $toDay);
$this->model->updateStat($atcl_vr_sq, 'R'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0109', '1', 'add'); // 리얼탑 열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
} else if ($img_chk_chk == 'G') {
$this->model->chgStat($atcl_vr_sq, '89', $toDay);
$this->model->updateStat($atcl_vr_sq, 'G'); // reg_status를 업데이트해준다.
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0110', '1', 'add'); // 리얼탑 기열람 불일치로 저장
$v2DailyModel->set_v2_st_daily(NULL, $v2_vrfc_req['cpid'], 'R0102', '1', 'add'); // 불일치로 저장
}
}
} else {
if (isset($send_result['error'])) {
$error_message = $send_result['error']['code'] . "\\n" . $send_result['error']['message'];
// API 호출 에러 발생시 해당 내용들을 DB에 저장해준다.
$err_time = date("Y-m-d H:i:s");
$this->model->saveApiErr($atcl_vr_sq, $send_result['error']['code'], $send_result['error']['message'], $err_time, $v2_vrfc_req['atcl_no']);
throw new \Exception($error_message);
} else {
throw new \Exception('네이버 전송 중 오류가 발생되었습니다. 다시 시도하세요.');
}
}
return $this->response->setJSON([
'code' => '0',
'msg' => 'success'
]);
}
} catch (\Exception $e) {
return $this->response->setJSON([
'code' => '9',
'msg' => $e->getMessage(),
]);
}
}
// 다음매물확인
public function nextRegi()
{

View File

@@ -0,0 +1,75 @@
<?php
namespace App\Controllers\V2;
use CodeIgniter\Model;
class V2StDailyModel extends Model
{
/**
* 일자별 통계데이터에 값 집어 넣기...
* 반환값 없음.
* @param date $sd_date 날짜 값이 없을경우 현재날짜로 입력됨.
* @param string $cpid CPID
* @param string $gbn_cd 코드값 (category='STATISTICS_DAILY3')
* @param int $cnt 더할 숫자..
* @param string $cnt_type 숫자를 더할것인지.. 아니변 변경할것인지.
*/
public function set_v2_st_daily($st_date, $cpid, $gbn_cd, $cnt, $cnt_type = 'add')
{
/**
* insert into v2_st_daily (sd_date, cpid, gbn_cd, cnt) values ($sd_date, $cpid, $gbn_cd, $cnt)
* on duplicate key update cnt = values(cnt); // $cnt_type='change'
* on duplicate key update cnt = cnt + $cnt; // $cnt_type='add'
*/
if (empty($cnt))
$cnt = '0';
$sql_dup = "";
switch (strtolower($cnt_type)) {
case 'add':
$sql_dup = "on duplicate key update cnt = cnt + " . $cnt;
break;
case 'change':
$sql_dup = "on duplicate key update cnt = values(cnt)";
break;
}
if (empty($st_date)) {
$sql = "insert into v2_st_daily (st_date, cpid, gbn_cd, cnt) values (now(), ?, ?, ?)" . $sql_dup;
$data = array(
$cpid,
$gbn_cd,
$cnt
);
} else {
$sql = "insert into v2_st_daily (st_date, cpid, gbn_cd, cnt) values (?, ?, ?, ?)" . $sql_dup;
$data = array(
$st_date,
$cpid,
$gbn_cd,
$cnt
);
}
$this->db->query($sql, $data);
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
return $return;
}
/**
* 지정한 매물의 요청번호를 이용하여 요청내역을 가져온다.
*/
public function get_v2_vrfc_req($vr_sq)
{
$columns = "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";
$builder = $this->db->table('v2_vrfc_req');
$builder->select($columns, false);
$builder->where('vr_sq', $vr_sq);
$row = $builder->get()->getRowArray();
return $row;
}
}

View File

@@ -245,8 +245,17 @@ if (!function_exists('db_now')) {
function db_now(?string $format = null)
{
if ($format) {
$mysqlFormat = strtr($format, [
'Y' => '%Y', 'y' => '%y',
'm' => '%m', 'n' => '%c',
'd' => '%d', 'j' => '%e',
'H' => '%H', 'h' => '%h',
'i' => '%i', 's' => '%s',
'A' => '%p', 'a' => '%p',
]);
// 포맷이 있으면 DATE_FORMAT(NOW(), '포맷') 형태로 생성
return new \CodeIgniter\Database\RawSql("DATE_FORMAT(NOW(), '$format')");
return new \CodeIgniter\Database\RawSql("DATE_FORMAT(NOW(), '$mysqlFormat')");
}
// 포맷이 없으면 기본 NOW() 반환
return new \CodeIgniter\Database\RawSql('NOW()');

View File

@@ -0,0 +1,57 @@
<?php
namespace App\Libraries;
class FormValidation
{
/**
* 한글, 영문, 숫자, 대시, 언더바만 가능하게 한다. utf-8 기준.
*
* @param string $str 검증할 문자열
* @param string|null $error 에러 메시지 (참조로 전달)
* @return bool
*/
public function korean_alpha_dash(string $str, ?string &$error = null): bool
{
if (!preg_match('/^[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z_-]+$/u', $str)) {
$error = '한글, 영문, 숫자, 대시, 언더바만 입력 가능합니다.';
return false;
}
return true;
}
/**
* 문자열 형식이 Date가 맞는지 확인한다.
*
* @param string $str 검증할 날짜 문자열
* @param string $format 날짜 형식 (기본값: Y-m-d)
* @param string|null $error 에러 메시지 (참조로 전달)
* @return bool
*/
public function is_date(string $str, string $format = 'Y-m-d', ?string &$error = null): bool
{
try {
if (empty($format)) {
$format = 'Y-m-d';
}
$date = strtotime($str);
if ($date === false) {
$error = '올바른 날짜 형식이 아닙니다.';
return false;
}
$strDate = date($format, $date);
if (strcmp($str, $strDate) !== 0) {
$error = "날짜 형식이 {$format}와 일치하지 않습니다.";
return false;
}
} catch (\Exception $e) {
$error = '날짜 검증 중 오류가 발생했습니다.';
return false;
}
return true;
}
}

View File

@@ -2,11 +2,22 @@
namespace App\Libraries;
use App\Models\common\CommonModel;
use App\Models\v2\M712Model;
use CodeIgniter\Model;
class NaverApiClient
{
protected $baseUrl = 'https://test-b2b.land.naver.com';
protected $charger = '';
private $commonModel;
public function __construct()
{
$this->commonModel = new CommonModel();
}
/**
* [GET] 매물 정보 조회
*/
@@ -21,15 +32,84 @@ class NaverApiClient
/**
* [PUT] 매물 정보 수정
* @param string $articleNumber 매물번호
* @param string charger 변경자
* @param array $updateData 수정할 데이터 (tradeType, price, space 등)
* string $tradeType 거래유형 (SALE:매매, JEONSE:전세, MONTHLY_RENT:월세, PRE_SALE:분양)
* boolean $isResidntsExistence 거주여부
* object $address 주소정보 공동 (complexNumber, pyeongTypeNumber, buildingName, hoName, correspondenceFloorCount) 비공동(legalDivisionNumber,jibunAddress,liAddress,etcAddress,referenceAddress,longitude,latitude,correspondenceFloorCount,totalFloorCount,undergroundFloorCount)
* object $price 가격정보 (dealAmount,warrantyAmount,leaseAmount,preSaleAmount,premiumAmount,preSaleOptionAmount)
* object $space 면적정보[비공동] (supplySpace,exclusiveSpace,totalSpace,groundSpace,buildingSpace)
* object $facilities 비공동시설정보 (roomCount)
*/
public function updateArticleInfo(string $articleNumber, array $updateData, string $charger = 'admin'): ?array
{
$this->charger = $charger;
$url = "{$this->baseUrl}/kiso/center/verification-article/{$articleNumber}?charger={$this->charger}";
return $this->request('PUT', $url, $updateData);
}
/**
* [POST] 4.매물검증 결과관리
* API:POST /kiso/center/verification-article/{매물번호}/report?charger={담당자명}
* @param string $articleNumber 매물번호
* @param string charger 변경자
* @param array $reportData 검증결과데이터
* string $reportType 검증결과유형 (검증통과:VERIFIED, 검증실패:FAILED, 최종실패:REJECTED)
* array $verificationConfirms 검증결과목록
* string $ownerBirthDate 소유자 생년월일
* Boolean $isOwnerVerifiable 소유자 검증여부
*/
public function postArticleVerificationReport(string $articleNumber, array $reportData, string $charger = 'admin'): ?array
{
$this->charger = $charger;
$url = "{$this->baseUrl}/kiso/center/verification-article/{$articleNumber}/report?charger={$this->charger}";
return $this->request('POST', $url, $reportData);
}
/**
* [POST] 5.현장확인 정보 전송
* API:POST /kiso/center//verification-article/media/{매물번호}
* @param string $articleNumber 매물번호
* @param array $movies 동영상 ($url)
* @param array $photos 사진 ($fileName, $url)
* @param array photo360s 360사진 ($fileName, $url, $desc)
* @param string $charger 변경자
*/
public function postArticleMediaInfo(string $articleNumber, array $movies, array $photos, array $photo360s, string $charger = 'admin'): ?array
{
$this->charger = $charger;
$url = "{$this->baseUrl}/kiso/center/verification-article/media/{$articleNumber}?charger={$this->charger}";
$data = [
'movies' => $movies,
'photos' => $photos,
'photo360s' => $photo360s
];
return $this->request('POST', $url, $data);
}
/**
* [POST] 6.매물 정보 가격수정
* @param string $articleNumber 매물번호
* @param array $priceData 가격 수정 데이터
* API:PATCH /kiso/center/verification-article/price/{매물번호}?charger={변경자}
* priceType int 가격유형 (DEAL:매매, WARRANTY:보증금, LEASE:월세, PRE_SALE:분양, PREMIUM:프리미엄, PRE_SALE_OPTION:분양옵션)
* dealAmount Int 매매금액
* warrantyAmount Int 보증금
* leaseAmount Int 월세금액
* preSaleAmount Int 분양금액
* premiumAmount Int 프리미엄금액
* preSaleOptionAmount Int 분양옵션금액
*/
public function postArticlePriceUpdate(string $articleNumber, array $priceData, string $charger = 'admin'): ?array
{
$this->charger = $charger;
$url = "{$this->baseUrl}/kiso/center/verification-article/price/{$articleNumber}?charger={$this->charger}";
return $this->request('POST', $url, $priceData);
}
public function submitSyncResult(string $reserveNoList): ?array
{
@@ -38,6 +118,323 @@ class NaverApiClient
return $this->request('GET', $url);
}
/**
* 단지상세정보조회
* hscpNo : 단지번호(숫자)
*/
public function aptDetail($hscpNo)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/APTDetail?hscpNo={$hscpNo}";
return $this->request('GET', $url);
}
/**
* 빌라 단지상세정보 조회
* hscpNo : 단지번호(숫자)
*/
public function villaDetail($hscpNo)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/villa/{$hscpNo}";
return $this->request('GET', $url);
}
/**
* 단지목록
* cortarNo : 법정동코드
*/
public function complexList($cortarNo)
{
$url = $this->commonModel->getCompanyInfo(2);
$url = $url['api_server'] . "/common/complexList.nhn?cortarNo={$cortarNo}";
return $this->request('GET', $url);
}
/**
* 평형목록
* rletNo : 단지번호
*/
public function ptpList($rletNo)
{
$url = $this->commonModel->getCompanyInfo(2);
$url = $url['api_server'] . "/common/ptpList.nhn?rletNo={$rletNo}";
return $this->request('GET', $url);
}
/**
* 가격수정
* @param String atclNo 매물번호
* @param integer dealAmt 매매가, 전세(보증금) 단위 : 만원
* @param integer wrrntAmt 전세가(보증금) 단위 : 만원
* @param integer leaseAmt 월세가 단위 : 만원
* @param integer isaleAmt 분양가 단위 : 만원
* @param integer premAmt 프리미엄 단위 : 만원
* @param integer charger 담당자id
*/
public function priceChange($atclNo, $dealAmt, $wrrntAmt, $leaseAmt, $isaleAmt, $premAmt, $charger)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/priceChange";
$postData = [
"atclNo" => $atclNo,
"dealAmt" => $dealAmt,
"wrrntAmt" => $wrrntAmt,
"leaseAmt" => $leaseAmt,
"isaleAmt" => $isaleAmt,
"premAmt" => $premAmt,
"charger" => $charger
];
return $this->request('POST', $url, $postData);
}
/**
* 매물정보수정
* @param String atclNo 매물번호
* @param integer hscpNo 단지번호
* @param integer ptpNo 평형번호
* @param String bildNm 동이름
* @param String rmNo 호수
* @param String tradeType 거래종류(A1,B1,B2 / 변경시 B1 <-> B2만 가능)
* @param integer dealAmt 매매가, 전세(보증금) 단위 : 만원
* @param integer wrrntAmt 전세가(보증금) 단위 : 만원
* @param integer leaseAmt 월세가 단위 : 만원
* @param integer isaleAmt 분양가 단위 : 만원
* @param integer premAmt 프리미엄 단위 : 만원
* @param integer floor 층
* @param integer charger 담당자id
*
* @param String addressCode 주소코드 : 비공동 주택 법정동 코드
* @param String address2 지번주소 : 비공동 주택 지번 주소
* @param String address3 기타주소 : 비공동 주택 기타 주소
* @param float splySpc 공급면적
* @param float exclsSpc 대지면적
* @param float totSpc 전체면적
* @param float grndSpc 대지면적
* @param float bldgSpc 건축면적
*
*/
public function modifyInfo($atclNo, $hscpNo, $ptpNo, $bildNm, $rmNo, $tradeType, $dealAmt, $wrrntAmt, $leaseAmt, $isaleAmt, $premAmt, $floor, $floor2, $charger, $addressCode, $address2, $address2a, $address2b, $address3, $splySpc, $exclsSpc, $totSpc, $grndSpc, $bldgSpc)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/modifyInfo";
// 공통
$postData = [
"atclNo" => $atclNo,
"tradeType" => $tradeType,
"dealAmt" => $dealAmt,
"wrrntAmt" => $wrrntAmt,
"leaseAmt" => $leaseAmt,
"isaleAmt" => $isaleAmt,
"charger" => $charger
];
// 공동주택
$apartData["hscpNo"] = $hscpNo;
$apartData["ptpNo"] = $ptpNo;
$apartData["bildNm"] = $address2; // 네이버에서 보내주는거랑 수정되어 전달하는 거랑 다른 타입임. 2014년 11월 13일 수정
$apartData["rmNo"] = $address3; // 네이버에서 보내주는거랑 수정되어 전달하는 거랑 다른 타입임. 2014년 11월 13일 수정
// $apartData["bildNm"] = $bildNm;
// $apartData["rmNo"] = $rmNo;
$apartData["premAmt"] = $premAmt;
$apartData["floor"] = $floor;
$apartData["floor2"] = $floor2;
// 비공동주택 연동
$detachData["addressCode"] = $addressCode;
$detachData["address2"] = $address2;
$detachData["address2a"] = $address2a;
$detachData["address2b"] = $address2b;
$detachData["address3"] = $address3;
$detachData["splySpc"] = $splySpc;
$detachData["exclsSpc"] = $exclsSpc;
$detachData["totSpc"] = $totSpc;
$detachData["grndSpc"] = $grndSpc;
$detachData["bldgSpc"] = $bldgSpc;
$detachData["floor"] = $floor;
$detachData["floor2"] = $floor2;
if (!empty($hscpNo)) { //공동주택일 때
$postData = array_merge($postData, $apartData);
} else { //비공동주택일 때
$postData = array_merge($postData, $detachData);
}
return $this->request('POST', $url, $postData);
}
/**
* 검증결과 전송
* @param String atclNo 매물번호
* @param boolean success 성공여부
* @param array checkList 확인정보 array('type'=>'T11','code'=>'10000','comment'=>'01|02|03'); 또는 array('type'=>'T11','code'=>'10000','comment'=>'코멘트');
* @param String charger 담당자 사번
* @param array modifyInfo 공동 비공동에 따라 다른 배열을 넘긴다.
* @param String date 상담일시
*/
public function confirm($atclNo, $success, $checkList, $charger, $modifyInfo, $date)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/confirm";
$postData = [
"atclNo" => $atclNo,
"success" => $success,
"checkList" => $checkList,
"charger" => $charger,
"modifyInfo" => $modifyInfo,
"date" => $date,
];
return $this->request('POST', $url, $postData);
}
/**
* 등기부 등본 확인 결과
* @param String atclNo 매물번호
* @param String type 1: 1차 확인(등기부확인) / 2: 2차 확인(최종확인 또는 중개업소 TM)
* @param boolean success 성공여부
* @param array checkList 확인정보
* @param String charger 담당자 사번
* @param String date 상담일시
* @param array modifyInfo 수정정보 - success:true 에서만 허용
*/
public function certification($atclNo, $type, $success, $checkList, $charger, $date, $modifyInfo, $ownerVerifiable)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/certification";
$postData = [
"atclNo" => $atclNo,
"type" => $type,
"success" => $success,
"checkList" => $checkList,
"charger" => $charger,
"date" => $date,
"modifyInfo" => $modifyInfo,
"ownerVerifiable" => $ownerVerifiable
];
return $this->request('POST', $url, $postData);
}
/**
* 등기부 등본 확인 결과
* 712 OwnerVerifiable 전송 오류 우회 테스트
*/
public function certification_712($atclNo, $type, $success, $checkList, $charger, $date, $modifyInfo, $ownerVerifiable)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/confirms/certification";
$model712 = new M712Model();
$data = $model712->getOwnerVerifiable($atclNo);
$ov = $data['OwnerVerifiable_change'];
if (isset($ov)) {
if ($ov > 0) {
$ownerVerifiable = true;
} else {
$ownerVerifiable = false;
}
} else {
$ownerVerifiable = null;
}
$postData = [
"atclNo" => $atclNo,
"type" => $type,
"success" => $success,
"checkList" => $checkList,
"charger" => $charger,
"date" => $date,
"modifyInfo" => $modifyInfo,
"ownerVerifiable" => $ownerVerifiable
];
log_message('debug', '712 certification_712 => ' . $atclNo . ' ::: ' . json_encode($postData) . PHP_EOL);
return $this->request('POST', $url, $postData);
}
/**
* 현장확인 거주인 여부 변경
*/
public function residentsExistence($reserveNumber, $isResidentsExist)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/residents/existence";
$postData = [
'reserveNumber' => $reserveNumber,
'isResidentsExist' => $isResidentsExist
];
return $this->request('POST', $url, $postData);
}
/**
* 예약확인 완료
*/
public function reserveSuccess($reserveNo, $modyfyYn, $agency, $team, $staff, $staffTel, $reserveYmd, $apm)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/site/reserveSuccess.nhn";
$getData = ['reserveNo' => $reserveNo, 'modyfyYn' => $modyfyYn, 'agency' => $agency, 'team' => $team, 'staff' => $staff, 'staffTel' => $staffTel, 'reserveYmd' => $reserveYmd, 'apm' => $apm];
return $this->request('POST', $url, $getData);
}
/**
* 예약확인 실패
*/
public function reserveFail($reserveNo, $errorCode, $etcTxt)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/site/reserveFail.nhn";
$getData = ['reserveNo' => $reserveNo, 'errorCode' => $errorCode, 'errorDesc' => $etcTxt];
return $this->request('POST', $url, $getData);
}
/**
* 촬영 실패
*/
public function shootFail($reserveNo, $errorCode, $etcTxt)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/site/shootFail.nhn";
$getData = ['reserveNo' => $reserveNo, 'errorCode' => $errorCode, 'errorDesc' => $etcTxt];
return $this->request('POST', $url, $getData);
}
/**
* 현장확인2 및 썸네일 검수 실패
*/
public function inspectFail($reserveNumber, $failDescription)
{
$url = $this->commonModel->getCompanyInfo(3);
$url = $url['api_server'] . "/site/vr/inspect/fail";
$postData = [
'reserveNumber' => $reserveNumber,
'failDescription' => $failDescription
];
return $this->request('POST', $url, $postData);
}
/**
* CURL 공통 실행 함수
*/
@@ -79,6 +476,17 @@ class NaverApiClient
'X-Naver-Client-Id: yqBbvQZ123_hjH3b3Df9'
]);
}
} elseif ($method === 'PATCH') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
if ($data) {
$payload = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'Content-Length: ' . strlen($payload),
'X-Naver-Client-Id: yqBbvQZ123_hjH3b3Df9'
]);
}
}
$response = curl_exec($ch);

View File

@@ -0,0 +1,132 @@
<?php
namespace App\Models\Entities;
use CodeIgniter\Model;
/**
* V2ModifyInfoModel
*
* v2_modify_info 테이블 - 수정정보 모델
* 부동산 매물의 수정된 정보를 저장하는 테이블
*/
class V2modifyinfoModel extends Model
{
protected $table = 'v2_modify_info';
protected $primaryKey = 'vr_sq';
protected $useAutoIncrement = false;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'vr_sq',
'bildNo',
'bild_nm',
'rm_no',
'floor',
'floor2',
'ugrodFloor',
'address_code',
'address2',
'address2a',
'address2b',
'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',
];
// 검증 규칙
// protected $validationRules = [
// 'vr_sq' => 'required|integer',
// 'bild_nm' => 'string|max_length[60]',
// 'rm_no' => 'string|max_length[30]',
// 'floor' => 'integer',
// 'floor2' => 'integer',
// 'ugrodFloor' => 'integer',
// 'address_code' => 'string|max_length[10]',
// 'address2' => 'string|max_length[300]',
// 'address2a' => 'string|max_length[300]',
// 'address2b' => 'string|max_length[300]',
// 'address3' => 'string|max_length[300]',
// 'address4' => 'string|max_length[1000]',
// 'trade_type' => 'string|max_length[2]',
// 'deal_amt' => 'integer',
// 'wrrnt_amt' => 'integer',
// 'lease_amt' => 'integer',
// 'isale_amt' => 'integer',
// 'prem_amt' => 'integer',
// 'sply_spc' => 'numeric',
// 'excls_spc' => 'numeric',
// 'tot_spc' => 'numeric',
// 'grnd_spc' => 'numeric',
// 'bldg_spc' => 'numeric',
// 'hscp_no' => 'string|max_length[30]',
// 'hscp_nm' => 'string|max_length[60]',
// 'ptp_no' => 'string|max_length[30]',
// 'ptp_nm' => 'string|max_length[60]',
// 'modify_yn' => 'in_list[Y,N]',
// ];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// 콜백
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
/**
* 검증요청순번(vr_sq)으로 수정정보 조회
*/
public function getByVrSq(int $vrSq): ?array
{
return $this->find($vrSq);
}
/**
* 수정정보 저장 (없으면 insert, 있으면 update)
* REPLACE INTO 사용으로 효율성 증대
*/
public function saveModifyInfo(int $vrSq, array $data): bool
{
$data['vr_sq'] = $vrSq;
return $this->replace($data);
}
/**
* 수정여부가 Y인 데이터 조회
*/
public function getModifiedInfo(): array
{
return $this->where('modify_yn', 'Y')->findAll();
}
/**
* 특정 검증요청의 수정여부 업데이트
*/
public function updateModifyYn(int $vrSq, string $yn = 'Y'): bool
{
return $this->update($vrSq, ['modify_yn' => $yn]);
}
}

View File

@@ -0,0 +1,231 @@
<?php
namespace App\Models\Entities;
use CodeIgniter\Model;
/**
* V2UrlImgSaveModel
*
* v2_url_img_save 테이블 - URL 이미지 저장 관리
* 홍보 및 등기 이미지 URL을 수신하여 저장 상태를 관리하는 테이블
*/
class V2urlimgsaveModel extends Model
{
protected $table = 'v2_url_img_save';
protected $primaryKey = 'pk';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $allowedFields = [
'pk',
'url',
'type',
'atcl_no',
'vr_sq',
'status',
'try_cnt',
'insert_dt',
'server_nm',
];
// 검증 규칙
protected $validationRules = [
'url' => 'string',
'type' => 'in_list[1,2]',
'atcl_no' => 'string|max_length[10]',
'vr_sq' => 'integer',
'status' => 'in_list[save,ing,done,err]',
'try_cnt' => 'integer|less_than_equal_to[3]',
'insert_dt' => 'valid_date',
'server_nm' => 'string|max_length[20]',
];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// 콜백
protected $allowCallbacks = true;
protected $beforeInsert = ['setInsertDate'];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
/**
* 삽입 전 insert_dt 자동 설정
*/
protected function setInsertDate(array $data)
{
if (!isset($data['data']['insert_dt'])) {
$data['data']['insert_dt'] = date('Y-m-d H:i:s');
}
return $data;
}
/**
* 상태별 데이터 조회 (save, ing, done, err)
*/
public function getByStatus(string $status): array
{
return $this->where('status', $status)->findAll();
}
/**
* vr_sq로 데이터 조회
*/
public function getByVrSq(int $vrSq): array
{
return $this->where('vr_sq', $vrSq)->findAll();
}
/**
* type과 vr_sq로 데이터 조회
*/
public function getByTypeAndVrSq(string $type, int $vrSq): array
{
return $this->where('type', $type)
->where('vr_sq', $vrSq)
->findAll();
}
/**
* atcl_no로 데이터 조회
*/
public function getByAtclNo(string $atclNo): array
{
return $this->where('atcl_no', $atclNo)->findAll();
}
/**
* 저장 대기 중인 데이터 조회 (save 상태)
*/
public function getPendingSave(): array
{
return $this->where('status', 'save')
->where('try_cnt <', 3)
->orderBy('insert_dt', 'ASC')
->findAll();
}
/**
* 저장 중인 데이터 조회 (ing 상태)
*/
public function getSaving(): array
{
return $this->where('status', 'ing')->findAll();
}
/**
* 저장 실패 데이터 조회 (err 상태)
*/
public function getErrors(): array
{
return $this->where('status', 'err')->findAll();
}
/**
* 특정 이미지 상태 업데이트
*/
public function updateStatus(int $pk, string $status): bool
{
return $this->update($pk, ['status' => $status]);
}
/**
* 재시도 횟수 증가
*/
public function incrementTryCount(int $pk): bool
{
$current = $this->find($pk);
if (!$current) {
return false;
}
$tryCount = ($current['try_cnt'] ?? 0) + 1;
$status = $tryCount >= 3 ? 'err' : 'save';
return $this->update($pk, [
'try_cnt' => $tryCount,
'status' => $status,
]);
}
/**
* 저장 완료 처리
*/
public function markAsDone(int $pk): bool
{
return $this->update($pk, ['status' => 'done']);
}
/**
* 저장 중 표시
*/
public function markAsProcessing(int $pk): bool
{
return $this->update($pk, ['status' => 'ing']);
}
/**
* 저장 실패 표시
*/
public function markAsError(int $pk): bool
{
return $this->update($pk, ['status' => 'err']);
}
/**
* 특정 vr_sq의 모든 이미지 저장 완료
*/
public function markAllDoneByVrSq(int $vrSq): bool
{
return $this->where('vr_sq', $vrSq)
->set(['status' => 'done'])
->update();
}
/**
* type별 통계
*/
public function getStatisticsByType(int $vrSq): array
{
$result = [
'1' => ['total' => 0, 'done' => 0, 'ing' => 0, 'save' => 0, 'err' => 0],
'2' => ['total' => 0, 'done' => 0, 'ing' => 0, 'save' => 0, 'err' => 0],
];
$records = $this->where('vr_sq', $vrSq)->findAll();
foreach ($records as $record) {
$type = $record['type'];
if (!isset($result[$type])) {
continue;
}
$result[$type]['total']++;
$status = $record['status'];
if (isset($result[$type][$status])) {
$result[$type][$status]++;
}
}
return $result;
}
/**
* 저장할 준비된 데이터 조회 (제한 개수)
*/
public function getNextBatch(int $limit = 10): array
{
return $this->where('status', 'save')
->where('try_cnt <', 3)
->orderBy('insert_dt', 'ASC')
->limit($limit)
->findAll();
}
}

View File

@@ -115,6 +115,22 @@ class DeptModel extends Model
return $query->getResultArray();
}
/**
* 부서검색(상세)
*/
public function getDeptDetail($dept_sq)
{
$sql = "SELECT dept_sq, pdept_sq, dept_nm, dept_desc, dept_head, use_yn, depth, insert_tm, insert_usr, update_tm, update_usr, lft, rgt" .
" FROM departments" .
" WHERE dept_sq = ?";
$data = array($dept_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
// 조직별통계
public function getDeptStatistics($data)
{

View File

@@ -116,6 +116,19 @@ class ReceiptModel extends Model
return $query->getResultArray();
}
public function getSrchUserInfo($usr_id)
{
$sql = "SELECT a.usr_sq, a.usr_id, b.dept_sq, b.pdept_sq FROM users a
JOIN departments b ON b.dept_sq = a.dept_sq
WHERE a.usr_id = ? AND a.use_yn = 'Y'";
$data = [$usr_id];
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
/**
* 부서검색(상세)
*/
@@ -149,6 +162,31 @@ class ReceiptModel extends Model
return $query->getResultArray();
}
/**
* 사용자 상세정보
*/
public function getUserDetail($usr_sq)
{
$builder = $this->db->table('users a');
$builder->select("
a.usr_sq,
a.dept_sq,
a.usr_id,
a.usr_nm,
a.usr_level,
a.usr_tel1,
a.usr_tel2,
b.dept_nm
", false);
$builder->join('departments b', 'a.dept_sq = b.dept_sq', 'left');
$builder->where('a.usr_sq', $usr_sq);
return $builder->get()->getRowArray();
}
public function getTotalCount($data)
{
$usr_sq = session('usr_sq');
@@ -1179,10 +1217,27 @@ class ReceiptModel extends Model
$builder->where('a.rcpt_key', $id);
return $builder->get()->getRowArray();
}
/**
* 사용자의 지정일자에 배정된 목록을 가져온다. (시간, 위치만...)
*/
public function getAssignReceiptListByUser($rsrv_date, $usr_sq, $arrExcept = [])
{
$sql = "SELECT a.rcpt_key, a.rcpt_atclno, a.rcpt_x, a.rcpt_y, b.rsrv_tm_ap, b.rsrv_tm_hour" .
" FROM receipt a" .
" INNER JOIN result b ON b.rcpt_sq = a.rcpt_sq AND b.usr_sq = ? AND b.rsrv_date = ?" .
" WHERE a.rcpt_key not in (?)";
$except_rcptKey = implode(',', $arrExcept);
$data = array($usr_sq, $rsrv_date, $except_rcptKey);
$query = $this->db->query($sql, $data);
$res = $query->getResultArray();
return $res;
}
public function getDupleGP($rcpt_key, $rcpt_sido, $rcpt_gugun, $rcpt_dong, $rcpt_hscp_nm, $rcpt_dtl_addr, $rcpt_ho)
{
$sql = "select rcpt_sq, c.rcpt_key, c.photo_save_dt from" .
@@ -1426,6 +1481,40 @@ class ReceiptModel extends Model
];
}
// 거주여부 저장
public function saveResDB($rcpt_sq, $rsrv_sq, $resYn, $dbUsageAgrYn)
{
$this->db->transStart();
$usr_id = session('usr_id');
$sql = "SELECT result_cd3, resYn, dbUsageAgrYn FROM result WHERE rsrv_sq = ?";
$data = array($rsrv_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
$sql = "UPDATE result" .
" SET resYn = ?" .
" ,dbUsageAgrYn = ?" .
" WHERE rsrv_sq = ?" .
" AND rcpt_sq = ?";
$data = array($resYn, $dbUsageAgrYn, $rsrv_sq, $rcpt_sq);
if ($this->db->query($sql, $data) === false) {
return [
'success' => false,
'msg' => '저장실패',
];
}
$this->saveChangedHistory($rcpt_sq, $row['result_cd3'], 'C24', $usr_id, $row['resYn'] . "|" . $row['dbUsageAgrYn']);
$this->db->transComplete();
return [
'success' => true,
];
}
// 평면도요청 저장
public function saveGround($rcpt_sq, $ground_plan)
{
@@ -2044,4 +2133,202 @@ class ReceiptModel extends Model
}
}
/**
* 배정자 등록
*/
public function assignRegist($rcpt_sq, $rsrv_date, $rsrv_tm_ap, $rsrv_tm_hour, $dept_sq, $usr_sq, $receipt)
{
// 세션정보
$usr_id = session('usr_id');
$reg_usr_sq = session('usr_sq');
$this->db->transStart();
// 변경전 기존 데이터 가져오기
$org_sql = "SELECT * FROM result WHERE rcpt_sq = ?";
$query = $this->db->query($org_sql, [$rcpt_sq]);
$row = $query->getRowArray();
// 예약확인
$sql1 = "UPDATE result" .
" SET rsrv_date = ?" .
" ,rsrv_tm_ap = ?" .
" ,rsrv_tm_hour = ?" .
" ,rsrv_save_dt = now()" .
" ,update_tm = now()" .
" ,update_usr = ?" .
" WHERE rcpt_sq = ?";
$data1 = [
$rsrv_date,
$rsrv_tm_ap,
$rsrv_tm_hour,
$reg_usr_sq,
$rcpt_sq
];
if ($this->db->query($sql1, $data1) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
// 배정
$sql2 = "UPDATE result" .
" SET dept_sq = ?" .
" ,usr_sq = ?" .
" ,result_cd1 = 20" .
" ,result_cd2 = 2000" .
" ,result_cd3 = 200000" .
" ,update_usr = ?" .
" ,update_tm = now()" .
" ,assign_save_dt = now()" .
" ,rsrv_cplt_dt = now()" .
" WHERE rcpt_sq = ?";
$data2 = [
$dept_sq,
$usr_sq,
$reg_usr_sq,
$rcpt_sq
];
if ($this->db->query($sql2, $data2) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
// 매물상태 변경
$rcpt_sql = "UPDATE receipt" .
" SET rcpt_stat = 200000" .
" WHERE rcpt_sq = ?";
$this->db->query($rcpt_sql, [$rcpt_sq]);
// 정보변경이력 저장
if (!empty($row)) {
$remark = "{$row['rsrv_date']} {$row['rsrv_tm_ap']} {$row['rsrv_tm_hour']}시 -> {$rsrv_date} {$rsrv_tm_ap} {$rsrv_tm_hour}";
} else {
$remark = "{$receipt['rsrv_date']} {$receipt['rsrv_tm_ap']} -> {$rsrv_date} {$rsrv_tm_hour}";
}
$this->saveChangedHistory($rcpt_sq, '200000', 'C11', $usr_id, $remark);
$this->db->transComplete();
return [
'success' => true,
];
}
/**
* 취소
*/
public function rsrvcancel($rcpt_sq, $rsrv_sq, $result_cd2, $result_cd3, $result_msg, $receipt)
{
// 세션정보
$usr_id = session('usr_id');
$usr_sq = session('usr_sq');
$usr_nm = session('usr_nm');
// 변경전 기존 데이터 가져오기
$org_sql = "SELECT * FROM result WHERE rcpt_sq = ?";
$query = $this->db->query($org_sql, [$rcpt_sq]);
$row = $query->getRowArray();
$this->db->transStart();
if ($result_cd2 == "9050") {
$sql = "UPDATE result" .
" SET result_cd1 = '90'" .
" ,result_cd2 = ?" .
" ,result_cd3 = ?" .
" ,result_msg = ?" .
" ,check_fail_dt = now()" .
" ,update_usr = ?" .
" ,update_tm = now()" .
" WHERE rsrv_sq = ?";
} else {
$sql = "UPDATE result" .
" SET result_cd1 = '90'" .
" ,result_cd2 = ?" .
" ,result_cd3 = ?" .
" ,result_msg = ?" .
" ,cancel_dt = now()" .
" ,update_usr = ?" .
" ,update_tm = now()" .
" WHERE rsrv_sq = ?";
}
$data = [
$result_cd2,
$result_cd3,
$result_msg,
$usr_sq,
$rsrv_sq
];
$res = $this->db->query($sql, $data);
if (!$res) {
$return = [
'success' => false,
'msg' => '저장실패',
];
} else {
// 매물상태 변경
$rcpt_sql = "UPDATE receipt" .
" SET rcpt_stat = ?" .
" WHERE rcpt_sq = ?";
$rcpt_data = [$result_cd3, $rcpt_sq];
$this->db->query($rcpt_sql, $rcpt_data);
// 정보변경이력 저장
if (!empty($row['result_msg'])) {
$remark = $row['result_msg'] . " -> " . $result_msg;
} else {
$remark = $result_msg;
}
$this->saveChangedHistory($rcpt_sq, $result_cd3, 'C5', $usr_id, $remark);
// 문자발송
if ($result_cd2 == "9010" || $result_cd2 == "9020") {
// 접수취소, 예약취소
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S2', $receipt);
} else if ($result_cd2 == "9030") {
// 방문전 취소
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S4', $receipt);
} else if ($result_cd2 == "9040") {
// 방문후 취소
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S5', $receipt);
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S5-1', $receipt);
} else if ($result_cd2 == "9045") {
// 촬영후 취소
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S6', $receipt);
}
if ($result_cd3 == "905010") {
// 거주인녹취실패 취소(검수실패)
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S9', $receipt);
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S9-1', $receipt);
} else if ($result_cd3 == "905020") {
// 홍보확인서 미수취 취소(검수실패)
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S11', $receipt);
$this->sendSms($receipt['agent_head_tel'], $receipt['agent_nm'], '1600-5749', $usr_nm, 0, $rsrv_sq, $rcpt_sq, 'S11-1', $receipt);
}
$return = [
'success' => true,
];
}
$this->db->transComplete();
return $return;
}
}

View File

@@ -17,4 +17,12 @@ class CommonModel extends Model
return $query->getResultArray();
}
public function getCompanyInfo($compSq)
{
$sql = "SELECT api_server, api_key, comp_nm FROM companies WHERE comp_sq = ?";
$data = [$compSq];
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
}

View File

@@ -146,4 +146,21 @@ class ReceiptModel extends Model
$data = [$imgSq, $faxSq];
$this->db->query($sql, $data);
}
// receipt 에서 지정한 1건만 가져온다.
public function selectReceiptOne($rcpt_sq)
{
$sql = "SELECT a.rcpt_sq,a.comp_sq,a.rcpt_rating,a.rcpt_key,a.rcpt_atclno,a.rcpt_type,a.rcpt_product,a.rcpt_product_nm,a.rcpt_product_area,a.rcpt_product_price,a.rcpt_product_info1,a.rcpt_product_info2,a.rcpt_product_info3,a.rcpt_product_info4,a.rcpt_product_info5,a.rcpt_office,a.rcpt_agent,a.rcpt_sido,a.rcpt_gugun,a.rcpt_dong,a.rcpt_hscp_nm,a.rcpt_dtl_addr,a.rcpt_floor,a.rcpt_bunji,a.rcpt_ho,a.rcpt_tm,a.rcpt_stat,a.rcpt_x,a.rcpt_y,a.rcpt_living_yn,a.cust_nm,a.cust_tel1,a.cust_tel2,a.cust_zip,a.cust_addr1,a.cust_addr2,a.remark,a.agent_id,a.agent_nm,a.agent_head,a.agent_head_tel,a.agent_contact,a.agent_contact_tel,a.agent_fax,a.rsrv_date,a.rsrv_tm_ap,a.insert_usr,a.insert_tm,a.update_usr,a.update_tm,a.svc_type1,a.svc_type2,a.reconf_yn,a.rcpt_exps_type" .
", b.region_nm" .
", c.rsrv_sq" .
" FROM receipt a" .
" LEFT JOIN region_codes b ON b.region_cd = a.rcpt_dong" .
" LEFT JOIN result c on c.rcpt_sq = a.rcpt_sq" .
" WHERE a.rcpt_sq = ?" .
" limit 1";
$data = [$rcpt_sq];
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
}

View File

@@ -191,6 +191,42 @@ class M415Model extends Model
return $res;
}
// 서류/전화 확인완료 시간 = 등기부등본 확인중 시간
public function getConfTimeForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '35'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 검증완료 시간
public function get_60_ForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '60'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 등기부등본 확인중 시간, 서류에서 등기로 넘어갈때 간혹 서류전화 확인 완료가 안찍히는 건들이 있다
public function get_cert_ing_TimeForHistory($vr_sq)
{
@@ -338,4 +374,228 @@ class M415Model extends Model
);
$this->db->query($sql, $data);
}
//전화확인 - 통화실패 카운트
public function getCallfailForHistory($vr_sq)
{
$sql = "SELECT 'x' from v2_chg_history" .
" WHERE vr_sq = ?" .
" AND chg_type= 'C29'" .
" ORDER BY seq desc" .
" LIMIT 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 서류/전화 인입시간
public function getSaveTimeForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '30'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 등기부등본 확인실패 시간
public function get_cert_failTimeForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '49'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
//등기부등본 확인완료(모바일)
public function insert_v2_time_required_M($atcl_no, $cpid, $vrfc_type, $insert_tm, $cert_comple_dt, $finishTime)
{
if (substr($insert_tm, 0, 10) == substr($cert_comple_dt, 0, 10)) {
if (('12:00:00' < substr($insert_tm, -8)) && (substr($insert_tm, -8) < '13:00:00')) {//접수시간이 12~13시 사이면 13시로 해준다
if ($cert_comple_dt > '13:00:00') { //검증완료가 13시 '이후'에 끝나면 접수시간을 13시로 변경해준다
$insert_tm = date("Y-m-d", time()) . " 13:00:00";
}
} else if (
(substr($insert_tm, -8) > '17:30:00' || substr($insert_tm, -8) < '08:59:59') && //접수와 확인완료시간이 모두 17:30:00 ~ 09:00:00 사이가 아니면
(substr($cert_comple_dt, -8) < '17:30:00' || substr($cert_comple_dt, -8) < '08:59:59')
) {
$insert_tm = date("Y-m-d", time()) . " 09:00:00";
}
} else {
if (substr($insert_tm, -8) > '17:30:00' || substr($insert_tm, -8) < '08:59:59') {
$insert_tm = date("Y-m-d", time()) . " 09:00:00";
}
}
$stan_date = substr($insert_tm, 0, 10);
$sql = "INSERT INTO v2_time_required(stan_date, atcl_no, cpid, vrfc_type, insert_tm, cert_comple_dt, cert_required_tm, tot_required_tm)" .
" VALUES(?, ?, ?, ?, ?, ?, TIMEDIFF(?,?), TIMEDIFF(?,?)) " .
" ON DUPLICATE KEY UPDATE insert_tm = VALUES(insert_tm), tel_doc_conf_dt=VALUES(tel_doc_conf_dt),conf_required_tm = VALUES(conf_required_tm),tot_required_tm = VALUES(tot_required_tm) ";
$data = array(
$stan_date,
$atcl_no,
$cpid,
$vrfc_type,
$insert_tm,
$cert_comple_dt,
$cert_comple_dt,
$insert_tm,
$cert_comple_dt,
$insert_tm
);
$this->db->query($sql, $data);
}
//등기부등본 확인완료(불일치)
public function update_v2_time_required_Conf($atcl_no, $cpid, $vrfc_type, $tel_doc_conf_dt, $cert_comple_dt, $sf)
{
if ($sf == 'F') {
if (substr($tel_doc_conf_dt, 0, 10) == substr($cert_comple_dt, 0, 10)) {
if (('12:00:00' < substr($tel_doc_conf_dt, -8)) && (substr($tel_doc_conf_dt, -8) < '13:00:00')) {//전서확인시간이 12~13시 사이면 13시로 해준다
// if (substr($finishTime, -8) > '13:00:00'){ //등본완료가 13시 '이후'에 끝나면 전서확인시간을 13시로 변경해준다
// $tel_doc_conf_dt = date("Y-m-d",time())." 13:00:00";
// }
}
}
}
$sql = "UPDATE v2_time_required " .
" SET cert_comple_dt = ?" .
" ,cert_required_tm = TIMEDIFF(?,?)" .//등본 소요시간 = 등본완료시간-/서확인완료시간
" WHERE atcl_no = ?";
$data = array(
$cert_comple_dt,
$cert_comple_dt,
$tel_doc_conf_dt,
$atcl_no
);
$this->db->query($sql, $data);
// echo $this->db->last_query().'<br>';
}
// 최초! 등기부등본 확인중 시간-모바일용
public function get_cert_M_timeForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '40'" .
" and chg_type= 'C9'" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 등기부등본 확인완료 시간
public function get_cert_confTimeForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '45'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
// 검증실패 시간
public function get_69_ForHistory($vr_sq)
{
$sql = "select insert_tm from v2_chg_history" .
" where vr_sq = ?" .
" and stat_cd = '69'" .
" and chg_type= 'C9'" .
" order by seq desc" .
" limit 1";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
//등기부등본 확인완료(일치/불일치), 검증완료/실패까지 갈때만!
public function update_v2_time_required_Conf_Done($atcl_no, $cpid, $vrfc_type, $tel_doc_conf_dt, $cert_comple_dt)
{
//1.검증소요시간 가져온다
$sql = "SELECT conf_required_tm" .
" FROM v2_time_required" .
" WHERE atcl_no = ?";
$data = array(
$atcl_no
);
$query = $this->db->query($sql, $data);
$res = $query->row_array();
if (substr($tel_doc_conf_dt, 0, 10) == substr($cert_comple_dt, 0, 10)) {
if (('12:00:00' < substr($tel_doc_conf_dt, -8)) && (substr($tel_doc_conf_dt, -8) < '13:00:00')) {//전서확인시간이 12~13시 사이면 13시로 해준다
if (substr($cert_comple_dt, -8) > '13:00:00') { //등본완료가 13시 '이후'에 끝나면 전서확인시간을 13시로 변경해준다
$tel_doc_conf_dt = date("Y-m-d", time()) . " 13:00:00";
}
}
}
//2.등본소요시간, 등본완료시간, 총소요시간을 넣는다
$sql = "UPDATE v2_time_required " .
" SET cert_comple_dt = ?" .
" ,cert_required_tm = TIMEDIFF(?,?)" . //등본 소요시간 = 등본완료시간-전/서확인완료시간
" ,tot_required_tm = ADDTIME(?,TIMEDIFF(?,?))" .//총소요시간 = 검증소요시간+등본소요시간
" WHERE atcl_no = ?";
$data = array(
$cert_comple_dt,
$cert_comple_dt,
$tel_doc_conf_dt,
$res['conf_required_tm'],
$cert_comple_dt,
$tel_doc_conf_dt,
$atcl_no
);
$this->db->query($sql, $data);
}
public function get_rlet_type_cd($vr_sq)
{
$sql = "SELECT rlet_type_cd
FROM v2_article_info
WHERE vr_sq = ?";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
$res = $query->getRowArray();
return $res;
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Models\v2;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M701Model extends Model
@@ -308,13 +309,13 @@ class M701Model extends Model
b.stat_cd,
c.bild_nm,
b.vrfc_type,
c.rm_no,
IFNULL(c.rm_no, '') as rm_no,
c.floor,
c.address_code,
c.address2,
m.address2a,
m.address2b,
c.address3,
IFNULL(c.address_code, '') as address_code,
IFNULL(c.address2, '') as address2,
IFNULL(m.address2a, '') as address2a,
IFNULL(m.address2b, '') as address2b,
IFNULL(c.address3, '') as address3,
c.trade_type,
c.deal_amt,
c.wrrnt_amt,
@@ -331,7 +332,7 @@ class M701Model extends Model
d.insert_tm as update_res_tm,
greatest(ifnull(d45.insert_tm, ''), ifnull(d49.insert_tm, '')) as rgbk_check_tm,
e.insert_tm as result_tm,
f.region_nm,
IFNULL(f.region_nm, '') as region_nm,
g.cd_nm as pre_stat,
h.cd_nm as vrfc_type,
i.usr_nm,
@@ -747,7 +748,7 @@ class M701Model extends Model
c.bild_nm,
b.vrfc_type as vrfc_type_cd,
b.memo,
c.rm_no,
IFNULL(c.rm_no, '') as rm_no,
c.floor,
c.floor2,
c.address_code,
@@ -887,6 +888,179 @@ class M701Model extends Model
}
// 가격수정
public function changePrice($param)
{
$this->db->transStart();
$usr_id = session('usr_id');
$detail = $this->getDetail($param['rcpt_key']);
if ($param['trade_type'] != 'B2') {
// 월세가 아닐경우에는 월세가에 0으로 ....
$data['lease_amt'] = $param['atcl_amt3'];
}
if (!empty($param['atcl_amt1']))
$data['deal_amt'] = $param['atcl_amt1'];
if (!empty($param['atcl_amt2']))
$data['wrrnt_amt'] = $param['atcl_amt2'];
if (!empty($param['atcl_amt3']))
$data['lease_amt'] = $param['atcl_amt3']; // 월세이고 월세가격이 입력되지 않았으면... 원래 금액으로
if (!empty($param['atcl_amt4']))
$data['deal_amt'] = $param['atcl_amt4'];
if (!empty($param['isale_amt']))
$data['isale_amt'] = $param['isale_amt'];
if (!empty($param['prem_amt']))
$data['prem_amt'] = $param['prem_amt'];
$data['modify_yn'] = 'Y';
$builder = $this->db->table('v2_modify_info');
$ok = $builder->where('vr_sq', $param['rcpt_key'])->update($data);
if ($ok === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$memo = "가격변경 ";
$this->saveHistory($detail['vr_sq'], $detail['pre_stat_cd'], 'C25', $usr_id, $memo);
$this->db->transComplete();
return [
'success' => true,
];
}
// 정보수정
public function modifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt)
{
$this->db->transStart();
$usr_id = session('usr_id');
$detail = $this->getDetail($atcl_vr_sq);
if ($trade_type != 'B2') {
// 월세가 아닐경우에는 월세가에 0으로 ....
$atcl_amt3 = '0';
$data['lease_amt'] = $atcl_amt3;
}
if (!empty($trade_type))
$data['trade_type'] = $trade_type;
if (!empty($atcl_hscp_nm))
$data['hscp_nm'] = $atcl_hscp_nm;
if (!empty($atcl_ptp_nm))
$data['ptp_nm'] = $atcl_ptp_nm;
if (!empty($atcl_addr1))
$data['address2'] = $atcl_addr1; // 폐기 예정
if (!empty($atcl_addr1a))
$data['address2a'] = $atcl_addr1a;
if (!empty($atcl_addr1b))
$data['address2b'] = $atcl_addr1b;
if (!empty($atcl_addr2))
$data['address3'] = $atcl_addr2;
if (!empty($atcl_hscp_no))
$data['hscp_no'] = $atcl_hscp_no;
if (!empty($atcl_ptp_no))
$data['ptp_no'] = $atcl_ptp_no;
if (!empty($atcl_amt1))
$data['deal_amt'] = $atcl_amt1;
if (!empty($atcl_amt2))
$data['wrrnt_amt'] = $atcl_amt2;
if (!empty($atcl_amt3))
$data['lease_amt'] = $atcl_amt3; // 월세이고 월세가격이 입력되지 않았으면... 원래 금액으로
if (!empty($atcl_amt4))
$data['deal_amt'] = $atcl_amt4;
if (!empty($isale_amt))
$data['isale_amt'] = $isale_amt;
if (!empty($prem_amt))
$data['prem_amt'] = $prem_amt;
if (!empty($atcl_floor))
$data['floor'] = $atcl_floor;
if (!empty($atcl_floor2))
$data['floor2'] = $atcl_floor2;
$data['modify_yn'] = 'Y';
$builder = $this->db->table('v2_modify_info');
$ok = $builder->where('vr_sq', $atcl_vr_sq)->update($data);
if ($ok === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$last_query = $this->db->getLastQuery();
$current_url = current_url();
$memo = "상세정보수정 ";
$this->saveHistory(vr_sq: $detail['vr_sq'], stat_cd: $detail['pre_stat_cd'], chg_type: 'C25', usr_id: $usr_id, memo: $memo);
$faxModel = new FaxModel();
$faxModel->updateAddress($atcl_vr_sq, $detail['address_code'], $data['address2'], $data['address3'], $data['hscp_no'], $data['hscp_nm']);
$this->db->transComplete();
return [
'success' => true,
];
}
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
{
$usr_id = session('usr_id');
$list = $this->get_detail($atcl_vr_sq); //변경된 내용 비교를 위해.
$data['vrfc_type'] = $atcl_vrfc_type;
$this->db->where('vr_sq', $atcl_vr_sq);
$this->db->trans_start();
$this->db->update('v2_vrfc_req', $data);
$data['vrfc_type_cd'] = $atcl_vrfc_type;
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affected_rows() > 0) {
// $changed = $this->what_is_changed($list['data'], $data, $atcl_vr_sq);
if (!empty($changed)) {
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, "상세정보 수정");
}
}
}
$this->db->transComplete();
return $return;
}
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
{
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
" VALUES (?, ?, ?, ?, ?, ?);";
$data = [
$err_sq,
$err_code,
$err_nm,
$err_time,
$err_no,
$err_server
];
$this->db->query($sql, $data);
}
// 상태변경
public function chgArticleStatus($data)
{
@@ -961,6 +1135,601 @@ class M701Model extends Model
];
}
// 현재상태확인
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = [
$vr_sq
];
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function chkTryCnt($vr_sq)
{
$columns = 'a.try_cnt';
$builder = $this->db->table('v2_vrfc_req a');
$builder->select($columns);
$builder->where('vr_sq', $vr_sq);
$query = $builder->get();
return $query->getRowArray();
}
public function chkRegiTryCnt($atcl_vr_sq)
{ //1차 검증인지 2차 검증인지 확인.
$builder = $this->db->table('v2_vrfc_req a');
$builder->select('a.reg_try_cnt');
$builder->where('vr_sq', $atcl_vr_sq);
$query = $builder->get();
return $query->getRowArray();
}
public function chkConfirm($vr_sq, $reg_yn)
{
$columns = "a.vr_sq";
$builder = $this->db->table('v2_confirm a');
$builder->select($columns);
$builder->where('vr_sq', $vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn); // 등기부등본 정보 확인시
}
$query = $builder->get();
$result = $query->getNumRows();
return $result;
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type, $usr_id = '', $usr_sq = '')
{
if (empty($usr_sq))
$usr_sq = session('usr_sq');
if (empty($usr_id))
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW()) " .
" ON DUPLICATE KEY UPDATE" .
" success=values(success), charger=values(charger)
, date=values(date), update_user=values(update_user), update_tm=values(update_tm)";
$data = [
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
];
$this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success,
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
}
public function chgRegiTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$this->db->transStart();
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)
VALUES (?, ?, ?, ?)
ON DUPLICATE KEY UPDATE
vr_sq = VALUES(vr_sq),
stat_cd = VALUES(stat_cd),
insert_user = VALUES(insert_user),
insert_tm = VALUES(insert_tm)";
$data = [
$vr_sq,
$stat_cd,
$usr_sq,
$insert_tm,
];
if ($this->db->query($sql, $data) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$this->saveHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, '서류확인 정보 변경');
$this->db->transComplete();
return [
'success' => true,
];
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = [
'stat_cd' => $stat_cd,
];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = [
'stat_cd' => $stat_cd,
];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
}
// 파일정보 저장
public function saveFileInfo($file)
{
$this->db->transStart();
$fileType = $file['file_type'] ?? '1';
// 기존 파일 확인
$sql = "SELECT seq FROM v2_files WHERE vr_sq = ? AND use_yn = 'Y' AND file_type = ?";
$query = $this->db->query($sql, [$file['vr_sq'], $fileType]);
$result = $query->getRow();
if (!empty($result)) {
// 기존 파일을 비활성화
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = ? AND file_type = ?";
$this->db->query($sql, [$file['vr_sq'], $fileType]);
}
// 새 파일 정보 INSERT
$data = [
'vr_sq' => $file['vr_sq'],
'use_yn' => 'Y',
'file_type' => $fileType,
'view_odr' => $file['view_odr'] ?? 0,
'file_path' => $file['file_path'],
'file_name' => $file['new_name'],
'file_ext' => $file['ext'],
'file_size' => $file['size'],
'insert_user' => session('usr_sq'),
'insert_tm' => date('Y-m-d H:i:s'),
'cloud_upload_yn' => 'Y',
];
$builder = $this->db->table('v2_files');
$builder->insert($data);
$this->db->transComplete();
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{
if (is_array($comment)) {
$comment = implode('|', $comment);
}
$usr_sq = session('usr_sq');
$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 = [
$vr_sq,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
];
$res = $this->db->query($sql, $data);
}
public function chgTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
/**
* 검증결과 전송 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]);
$rowVrfcReq = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 매물정보
$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]);
$rowArticleInfo = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$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]);
$rowModifyInfo = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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, $rowVrfcReq['vrfc_type']]);
$rowConfirm = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$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, $rowVrfcReq['vrfc_type']]);
$resCheckList = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
if (!empty($rowConfirm)) {
log_message('debug', implode(', ', $rowConfirm));
}
$atclNo = $rowVrfcReq['atcl_no'] ?? null;
$success = !empty($rowConfirm['success']);
$charger = $rowConfirm['charger'] ?? null;
$date = $rowConfirm['date'] ?? null;
$tryCnt = $rowVrfcReq['try_cnt'] ?? 0;
$checkList = [];
foreach ($resCheckList as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['ownerBirth'],
];
}
$modifyInfo = [];
if (($rowModifyInfo['modify_yn'] ?? 'N') === 'Y') {
if (!empty($rowModifyInfo['hscp_no'])) {
// 공동주택
$modifyInfo = [
'hscpNo' => $rowModifyInfo['hscp_no'],
'ptpNo' => $rowModifyInfo['ptp_no'],
'bildNm' => $rowModifyInfo['address2'],
'rmNo' => $rowModifyInfo['address3'],
'tradeType' => $rowModifyInfo['trade_type'],
'dealAmt' => $rowModifyInfo['deal_amt'],
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
'leaseAmt' => $rowModifyInfo['lease_amt'],
'isaleAmt' => $rowModifyInfo['isale_amt'],
'premAmt' => $rowModifyInfo['prem_amt'],
'floor' => $rowModifyInfo['floor'],
];
} else {
// 비공동주택
$modifyInfo = [
'addressCode' => $rowModifyInfo['address_code'],
'address2' => $rowModifyInfo['address2'],
'address3' => $rowModifyInfo['address3'],
'tradeType' => $rowModifyInfo['trade_type'],
'dealAmt' => $rowModifyInfo['deal_amt'],
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
'leaseAmt' => $rowModifyInfo['lease_amt'],
'splySpc' => $rowModifyInfo['sply_spc'],
'exclsSpc' => $rowModifyInfo['excls_spc'],
'totSpc' => $rowModifyInfo['tot_spc'],
'grndSpc' => $rowModifyInfo['grnd_spc'],
'bldgSpc' => $rowModifyInfo['bldg_spc'],
'floor' => $rowModifyInfo['floor'],
'floor2' => $rowModifyInfo['floor2'],
];
}
return [
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'try_cnt' => $tryCnt,
];
}
return [
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'try_cnt' => $tryCnt,
];
}
/* 등기부등본 API 호출*/
/**
* $vrfc_type: 값이 R이면 등기부등본
*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, reg_try_cnt, owner_verifiable
FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$rowVrfcReq = $query->getRowArray();
if (!empty($vrfc_type)) {
$rowVrfcReq['vrfc_type'] = $vrfc_type;
}
log_message('debug', (string) $this->db->getLastQuery());
// 매물정보
$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]);
$rowArticleInfo = $query->getRowArray();
log_message('debug', (string) $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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]);
$rowModifyInfo = $query->getRowArray();
log_message('debug', (string) $this->db->getLastQuery());
// 검증결과
$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, $rowVrfcReq['vrfc_type']]);
$rowConfirm = $query->getRowArray();
log_message('debug', (string) $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth
FROM v2_check_list a
INNER JOIN v2_article_info b ON a.vr_sq = b.vr_sq
WHERE a.vr_sq = ? AND a.vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $rowVrfcReq['vrfc_type']]);
$resCheckList = $query->getResultArray();
log_message('debug', (string) $this->db->getLastQuery());
if (!empty($rowConfirm)) {
log_message('debug', implode(', ', $rowConfirm));
}
$atclNo = $rowVrfcReq['atcl_no'] ?? null;
$type = $rowVrfcReq['try_cnt'] ?? null;
$success = !empty($rowConfirm['success']);
$charger = $rowConfirm['charger'] ?? null;
$date = $rowConfirm['date'] ?? null;
switch ($rowVrfcReq['owner_verifiable'] ?? null) {
case '1':
case 'true':
$ownerVerifiable = true;
break;
default:
$ownerVerifiable = false;
break;
}
$checkList = [];
foreach ($resCheckList as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
];
}
$modifyInfo = [];
if (($rowModifyInfo['modify_yn'] ?? 'N') === 'Y') {
if (!empty($rowModifyInfo['hscp_no'])) {
$modifyInfo = [
'hscpNo' => $rowModifyInfo['hscp_no'],
'ptpNo' => $rowModifyInfo['ptp_no'],
'bildNm' => $rowModifyInfo['address2'],
'rmNo' => $rowModifyInfo['address3'],
'tradeType' => $rowModifyInfo['trade_type'],
'dealAmt' => $rowModifyInfo['deal_amt'],
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
'leaseAmt' => $rowModifyInfo['lease_amt'],
'isaleAmt' => $rowModifyInfo['isale_amt'],
'premAmt' => $rowModifyInfo['prem_amt'],
'floor' => $rowModifyInfo['floor'],
];
} else {
$modifyInfo = [
'addressCode' => $rowModifyInfo['address_code'],
'address2' => $rowModifyInfo['address2'],
'address3' => $rowModifyInfo['address3'],
'tradeType' => $rowModifyInfo['trade_type'],
'dealAmt' => $rowModifyInfo['deal_amt'],
'wrrntAmt' => $rowModifyInfo['wrrnt_amt'],
'leaseAmt' => $rowModifyInfo['lease_amt'],
'splySpc' => $rowModifyInfo['sply_spc'],
'exclsSpc' => $rowModifyInfo['excls_spc'],
'totSpc' => $rowModifyInfo['tot_spc'],
'grndSpc' => $rowModifyInfo['grnd_spc'],
'bldgSpc' => $rowModifyInfo['bldg_spc'],
'floor' => $rowModifyInfo['floor'],
'floor2' => $rowModifyInfo['floor2'],
];
}
return [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
];
}
return [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
];
}
public function InsCharger($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$this->db->query($sql, $data);
}
public function getUpdateFailTime1($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = '39' " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function getUpdateFailTime2($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = '49' " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function deleteChkList($vr_sq, $vrfc_type, $type)
{
$sql = "delete from v2_check_list where vr_sq = ? and vrfc_type = ? and type = ?";
$data = array(
$vr_sq,
$vrfc_type,
$type
);
$this->db->query($sql, $data);
}
public function up_tel_fail_cause($vr_sq, $tel_fail_cause)
{
$sql = "UPDATE v2_vrfc_req" .
" SET tel_fail_cause = ? " .
" WHERE vr_sq = ?";
$data = array(
$tel_fail_cause,
$vr_sq
);
$this->db->query($sql, $data);
}
// 변경이력 저장
public function saveHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Models\v2;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M702Model extends Model
@@ -294,13 +295,13 @@ class M702Model extends Model
b.stat_cd,
c.bild_nm,
b.vrfc_type as vrfc_type_cd,
c.rm_no,
IFNULL(c.rm_no, '') as rm_no,
c.floor,
c.address_code,
c.address2,
k.address2a,
k.address2b,
c.address3,
IFNULL(c.address2, '') as address2,
IFNULL(k.address2a, '') as address2a,
IFNULL(k.address2b, '') as address2b,
IFNULL(c.address3, '') as address3,
c.trade_type,
c.deal_amt,
c.wrrnt_amt,
@@ -316,7 +317,7 @@ class M702Model extends Model
c.ptp_no,
d.insert_tm as update_res_tm,
e.insert_tm as result_tm,
f.region_nm,
IFNULL(f.region_nm , '') as region_nm,
g.cd_nm as pre_stat,
h.cd_nm as vrfc_type,
i.usr_nm,
@@ -740,6 +741,78 @@ class M702Model extends Model
];
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{ //상태변경 TABLE INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
"VALUES (?, ?, ?, ?)" .
"ON DUPLICATE KEY " .
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = array(
'vr_sq' => $vr_sq
,
'stat_cd' => $stat_cd
,
'usr_sq' => $usr_sq
,
'insert_tm' => $insert_tm
);
$this->db->transStart();
$res = $this->db->query($sql, $data);
// echo $this->db->last_query();
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
if (empty($return['error_number'])) {
//로그를 남긴다.
if ($this->db->affected_rows() > 0) {
if (!empty($changed)) {
$this->saveHistory($list['data']['vr_sq'], $stat_cd, 'C9', $usr_id, "등기부등본확인 정보 수정"); //검증결과 변동사항 HISTORY
}
}
}
$this->db->transComplete();
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'] ?? null;
$return['error_message'] = $error['message'] ?? null;
return $return;
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'] ?? null;
$return['error_message'] = $error['message'] ?? null;
return $return;
}
// 상태변경 시각 기록
public function saveV2ChgStat($vr_sq, $stat_cd, $insert_user)
{
@@ -752,6 +825,45 @@ class M702Model extends Model
$this->db->query($sql, [$vr_sq, $stat_cd, $insert_user]);
}
// 파일정보 저장
public function saveFileInfo($file)
{
$this->db->transStart();
$fileType = $file['file_type'] ?? '1';
// 기존 파일 확인
$sql = "SELECT seq FROM v2_files WHERE vr_sq = ? AND use_yn = 'Y' AND file_type = ?";
$query = $this->db->query($sql, [$file['vr_sq'], $fileType]);
$result = $query->getRow();
if (!empty($result)) {
// 기존 파일을 비활성화
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = ? AND file_type = ?";
$this->db->query($sql, [$file['vr_sq'], $fileType]);
}
// 새 파일 정보 INSERT
$data = [
'vr_sq' => $file['vr_sq'],
'use_yn' => 'Y',
'file_type' => $fileType,
'view_odr' => $file['view_odr'] ?? 0,
'file_path' => $file['file_path'],
'file_name' => $file['new_name'],
'file_ext' => $file['ext'],
'file_size' => $file['size'],
'insert_user' => session('usr_sq'),
'insert_tm' => date('Y-m-d H:i:s'),
'cloud_upload_yn' => 'Y',
];
$builder = $this->db->table('v2_files');
$builder->insert($data);
$this->db->transComplete();
}
// 변경이력 저장
public function saveHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)
@@ -925,6 +1037,490 @@ class M702Model extends Model
}
/* 매물정보를 수정 */
//public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2){
public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2)
{
$usr_id = session('usr_id');
$list = $this->getDetail($atcl_vr_sq);
if ($trade_type !== 'B2') {
$atcl_amt3 = '0';
$data['lease_amt'] = $atcl_amt3;
}
if (!empty($trade_type)) {
$data['trade_type'] = $trade_type;
}
if (!empty($atcl_hscp_nm)) {
$data['hscp_nm'] = $atcl_hscp_nm;
}
if (!empty($atcl_ptp_nm)) {
$data['ptp_nm'] = $atcl_ptp_nm;
}
if (!empty($atcl_addr1)) {
$data['address2'] = $atcl_addr1;
}
if (!empty($atcl_addr1a)) {
$data['address2a'] = $atcl_addr1a;
}
if (!empty($atcl_addr1b)) {
$data['address2b'] = $atcl_addr1b;
}
if (!empty($atcl_addr2)) {
$data['address3'] = $atcl_addr2;
}
if (!empty($atcl_hscp_no)) {
$data['hscp_no'] = $atcl_hscp_no;
}
if (!empty($atcl_ptp_no)) {
$data['ptp_no'] = $atcl_ptp_no;
}
if (!empty($atcl_amt1)) {
$data['deal_amt'] = $atcl_amt1;
}
if (!empty($atcl_amt2)) {
$data['wrrnt_amt'] = $atcl_amt2;
}
if (!empty($atcl_amt3)) {
$data['lease_amt'] = $atcl_amt3;
}
if (!empty($atcl_floor)) {
$data['floor'] = $atcl_floor;
}
if (!empty($atcl_floor2)) {
$data['floor2'] = $atcl_floor2;
}
$data['modify_yn'] = 'Y';
$this->db->transStart();
$builder = $this->db->table('v2_modify_info');
$builder->where('vr_sq', $atcl_vr_sq);
$builder->update($data);
$lastQuery = (string) $this->db->getLastQuery();
$currentUrl = current_url();
log_message('debug', "{$currentUrl} :: {$lastQuery}");
$data['trade_type_cd'] = $trade_type;
$error = $this->db->error();
$return['error_number'] = $error['code'] ?? null;
$return['error_message'] = $error['message'] ?? null;
if (empty($return['error_number'])) {
if ($this->db->affectedRows() > 0) {
if (!empty($changed)) {
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, '매물정보 수정');
}
}
}
$this->db->transComplete();
$faxModel = new FaxModel();
$faxModel->updateAddress($atcl_vr_sq, $list['data']['address_code'], $data['address2'], $data['address3'], $data['hscp_no'], $data['hscp_nm']);
return $return;
}
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
{
$usr_id = session('usr_id');
$list = $this->getDetail($atcl_vr_sq);
$data = [
'vrfc_type' => $atcl_vrfc_type,
];
$this->db->transStart();
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $atcl_vr_sq);
$builder->update($data);
$data['vrfc_type_cd'] = $atcl_vrfc_type;
$error = $this->db->error();
$return['error_number'] = $error['code'] ?? null;
$return['error_message'] = $error['message'] ?? null;
if (empty($return['error_number'])) {
if ($this->db->affectedRows() > 0) {
if (!empty($changed)) {
$this->saveHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, '매물정보 저장');
}
}
}
$this->db->transComplete();
return $return;
}
// 현재상태확인
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = [
$vr_sq
];
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function chkRegiTryCnt($atcl_vr_sq)
{
$builder = $this->db->table('v2_vrfc_req a');
$builder->select('a.reg_try_cnt');
$builder->where('vr_sq', $atcl_vr_sq);
$query = $builder->get();
return $query->getRowArray();
}
public function chkConfirm($atcl_vr_sq, $reg_yn)
{ //검증결과 table에 있는지 확인.
$builder = $this->db->table('v2_confirm a');
$builder->select('a.vr_sq');
$builder->where('a.vr_sq', $atcl_vr_sq);
if (!empty($reg_yn)) {
$builder->where('a.vrfc_type', $reg_yn); // 등기부등본 정보 확인시
}
return $builder->get()->getNumRows();
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
{ //v2_confirm INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success,
'update_user' => session('usr_sq'),
'update_tm' => date('Y-m-d H:i:s')
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'] ?? null;
$return['error_message'] = $error['message'] ?? null;
return $return;
}
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
{
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
" VALUES (?, ?, ?, ?, ?, ?);";
$data = array(
$err_sq,
$err_code,
$err_nm,
$err_time,
$err_no,
$err_server
);
$res = $this->db->query($sql, $data);
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$res = $this->db->query($sql, $data);
}
/* 등기부등본 API 호출*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, owner_verifiable" .
" FROM v2_vrfc_req where vr_sq = ?";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row_vrfc_req = $query->getRowArray();
if (!empty($vrfc_type)) {
$row_vrfc_req['vrfc_type'] = $vrfc_type;
}
log_message('debug', $this->db->getLastQuery());
// 매물정보
$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 = ?";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row_article_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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 = ?";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row_modify_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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 = ?";
$data = array($vr_sq, $row_vrfc_req['vrfc_type']);
$query = $this->db->query($sql, $data);
$row_confirm = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
" FROM v2_check_list a " .
" INNER JOIN v2_article_info b on a.vr_sq = b.vr_sq" .
" WHERE a.vr_sq = ? and a.vrfc_type = ?";
// " FROM v2_check_list where vr_sq = ? and vrfc_type = ? and type like concat(vrfc_type, '%')";
$data = array($vr_sq, $row_vrfc_req['vrfc_type']);
$query = $this->db->query($sql, $data);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm));
$atclNo = $row_vrfc_req['atcl_no'];
$type = $row_vrfc_req['try_cnt'];
$success = empty($row_confirm['success']) ? FALSE : TRUE;
$charger = $row_confirm['charger'];
$date = $row_confirm['date'];
if ($row_vrfc_req['owner_verifiable'] == 'false') {
$ownerVerifiable = FALSE;
} else {
$ownerVerifiable = TRUE;
}
$checkList = array();
foreach ($res_check_list as $row) {
$checkList[] = array(
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
);
}
$modifyInfo = array();
if ($row_modify_info['modify_yn'] == 'Y') {
if (!empty($row_modify_info['hscp_no'])) {
// 공동주택
$modifyInfo = array(
'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 = array(
'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 array(
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
);
} else {
return array(
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
);
}
}
public function chgRegiTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$res = $this->db->query($sql, $data);
}
public function InsCharger($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function chkTryCnt($atcl_vr_sq)
{
$builder = $this->db->table('v2_vrfc_req a');
$builder->select('a.try_cnt');
$builder->where('a.vr_sq', $atcl_vr_sq);
$query = $builder->get();
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['memo'], $data['vr_sq']]) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$detail = $this->getDetail($data['vr_sq']);
$memo = "메모변경 : " . $detail['memo'] . " => " . $data['memo'];
$this->saveHistory($data['vr_sq'], $data['pre_stat_cd'], 'C19', $usr_id, $memo);
return [
'success' => true,
];
}
public function chgTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
// 변경이력 조회
public function getHistory($vr_sq)
{

View File

@@ -2,6 +2,7 @@
namespace App\Models\v2;
use App\Models\receipt\ReceiptModel;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M703Model extends Model
@@ -1504,8 +1505,9 @@ class M703Model extends Model
$this->saveChangedHistory($vr_sq, '35', 'C9', $insert_id, '현장확인 매물');
$fax = $this->fax_model->selectFax($fax_sq); // fax 이미지 파일 가져오기
$receipt = $this->receipt_model->selectReceiptOne($vr_sq); // 매물정보 가져오기
$faxModel = new FaxModel();
$fax = $faxModel->selectFax($fax_sq); // fax 이미지 파일 가져오기
$receipt = $this->selectReceiptOne($vr_sq); // 매물정보 가져오기
// 40: 촬영, 70: 검수지연... 상태가 촬용 이전 또는 검수지연 상태일 경우에만 홍보확인서를 등록한다.
if (substr($receipt['rcpt_stat'], 0, 2) <= '40' || substr($receipt['rcpt_stat'], 0, 2) == '70') {
@@ -2115,8 +2117,8 @@ class M703Model extends Model
*/
public function saveChangeStep($fax_sq, $vr_sq, $stat_cd)
{
$insert_user = $this->session->userdata('usr_sq');
$insert_id = $this->session->userdata('usr_id');
$insert_user = session('usr_sq');
$insert_id = session('usr_id');
$this->db->transStart();

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Models\v2;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M704Model extends Model
@@ -787,6 +788,149 @@ class M704Model extends Model
return $query->getRowArray();
}
/* 매물정보를 수정 */
//public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt){
public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2, $atcl_amt4, $isale_amt, $prem_amt)
{
$usr_id = session('usr_id');
$list = $this->getDetail($atcl_vr_sq); // 변경된 내용 비교를 위해.
if ($trade_type != 'B2') {
// 월세가 아닐경우에는 월세가에 0으로 ....
$atcl_amt3 = '0';
$data['lease_amt'] = $atcl_amt3;
}
$data = [];
if (!empty($trade_type))
$data['trade_type'] = $trade_type;
if (!empty($atcl_hscp_nm))
$data['hscp_nm'] = $atcl_hscp_nm;
if (!empty($atcl_ptp_nm))
$data['ptp_nm'] = $atcl_ptp_nm;
if (!empty($atcl_addr1))
$data['address2'] = $atcl_addr1; // 폐기 예정
if (!empty($atcl_addr1a))
$data['address2a'] = $atcl_addr1a;
if (!empty($atcl_addr1b))
$data['address2b'] = $atcl_addr1b;
if (!empty($atcl_addr2))
$data['address3'] = $atcl_addr2;
if (!empty($atcl_hscp_no))
$data['hscp_no'] = $atcl_hscp_no;
if (!empty($atcl_ptp_no))
$data['ptp_no'] = $atcl_ptp_no;
if (!empty($atcl_amt1))
$data['deal_amt'] = $atcl_amt1;
if (!empty($atcl_amt2))
$data['wrrnt_amt'] = $atcl_amt2;
if (!empty($atcl_amt3))
$data['lease_amt'] = $atcl_amt3;
if (!empty($atcl_amt4))
$data['deal_amt'] = $atcl_amt4;
if (!empty($isale_amt))
$data['isale_amt'] = $isale_amt;
if (!empty($prem_amt))
$data['prem_amt'] = $prem_amt;
if (!empty($atcl_floor))
$data['floor'] = $atcl_floor;
if (!empty($atcl_floor2))
$data['floor2'] = $atcl_floor2;
$data['modify_yn'] = 'Y';
$this->db->transStart();
$builder = $this->db->table('v2_modify_info');
$builder->where('vr_sq', $atcl_vr_sq);
$builder->update($data);
$last_query = $this->db->getLastQuery();
$current_url = current_url();
log_message('debug', "{$current_url} :: {$last_query}");
$data['trade_type_cd'] = $trade_type;
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affectedRows() > 0) {
$changed = $this->whatIsChanged($list, $data, $atcl_vr_sq);
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $list['pre_stat_cd'], 'C25', $usr_id, $changed);
}
}
}
$this->db->transComplete();
// 홍보확인서인 경우 주소 변경시 FAX 이미지의 정보도 함께 변경한다.
$faxModel = new FaxModel();
$faxModel->updateAddress($atcl_vr_sq, $list['address_code'], $data['address2'] ?? '', $data['address3'] ?? '', $data['hscp_no'] ?? '', $data['hscp_nm'] ?? '');
return $return;
}
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
{
$usr_id = session('usr_id');
$list = $this->getDetail($atcl_vr_sq); // 변경된 내용 비교를 위해.
$data = [];
$data['vrfc_type'] = $atcl_vrfc_type;
$this->db->transStart();
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $atcl_vr_sq);
$builder->update($data);
$last_query = $this->db->getLastQuery();
$current_url = current_url();
log_message('debug', "{$current_url} :: {$last_query}");
$data['vrfc_type_cd'] = $atcl_vrfc_type;
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
if (empty($return['error_number'])) {
// 로그를 남긁다.
if ($this->db->affectedRows() > 0) {
$changed = $this->whatIsChanged($list, $data, $atcl_vr_sq);
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $list['pre_stat_cd'], 'C25', $usr_id, $changed);
}
}
}
$this->db->transComplete();
return $return;
}
public function saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
{
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
" VALUES (?, ?, ?, ?, ?, ?);";
$data = array(
$err_sq,
$err_code,
$err_nm,
$err_time,
$err_no,
$err_server
);
$this->db->query($sql, $data);
}
// 메모조회
public function getMemo($vr_sq)
{
@@ -971,6 +1115,30 @@ class M704Model extends Model
];
}
// 전화실패
public function saveContactFail($vr_sq)
{
$usr_id = session('usr_id');
$sql = "update v2_vrfc_req set contact_fail_cnt = ifnull(contact_fail_cnt, 0) +1 where vr_sq = ?";
$data = array($vr_sq);
if ($this->db->query($sql, $data) === false) {
return [
'success' => false,
'msg' => '통화실패 처리중 오류가 발생했습니다.',
];
}
$row = $this->getDetail($vr_sq);
$this->saveChangedHistory($vr_sq, $row['data']['stat_cd'], 'C29', $usr_id, '통화실패');
return [
'success' => true
];
}
// 다음 전화매물 가져오기
public function getNextTelInfo($vr_sq)
{
@@ -1003,4 +1171,409 @@ class M704Model extends Model
return $row;
}
/* 현재 상태 확인 */
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function InsCharger($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function chkTryCnt($atcl_vr_sq)
{
// 1차 검증인지 2차 검증인지 확인.
$sql = "SELECT try_cnt FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$atcl_vr_sq]);
return $query->getRowArray();
}
/*
* 등기부등본 확인중의 상태인 적이 있었는지 확인
*/
public function chkHistoryStat($atcl_vr_sq)
{
$sql = "select count(a.stat_cd) from v2_chg_history a " .
"where vr_sq = ? and stat_cd = 40 " .
"order by vr_sq desc;";
$data = array(
$atcl_vr_sq
);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function chkConfirm($atcl_vr_sq, $reg_yn = null)
{
$builder = $this->db->table('v2_confirm');
$builder->select('vr_sq');
$builder->where('vr_sq', $atcl_vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn);
}
$query = $builder->get();
return $query->getNumRows();
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
{ //v2_confirm INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$this->db->query($sql, $data);
}
public function getUpdateFailTime($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = 39 " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
return $return;
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{
// 상태변경 TABLE INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
"VALUES (?, ?, ?, ?)" .
"ON DUPLICATE KEY " .
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = [
$vr_sq,
$stat_cd,
$usr_sq,
$insert_tm
];
$this->db->transStart();
$res = $this->db->query($sql, $data);
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affectedRows() > 0) {
$changed = "전화확인 정보 저장";
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, $changed);
}
}
}
$this->db->transComplete();
return $return;
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
return $return;
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
$return['error_number'] = $error['code'];
$return['error_message'] = $error['message'];
return $return;
}
public function chgRegTryCnt($vr_sq, $reg_try_cnt)
{
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$reg_try_cnt,
$vr_sq
);
$res = $this->db->query($sql, $data);
}
public function chgTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', "704 => " . $log_v);
}
public function deleteChkList($vr_sq, $vrfc_type, $type)
{
$sql = "delete from v2_check_list where vr_sq = ? and vrfc_type = ? and type = ?";
$data = array(
$vr_sq,
$vrfc_type,
$type
);
$this->db->query($sql, $data);
}
public function up_tel_fail_cause($vr_sq, $tel_fail_cause)
{
$sql = "UPDATE v2_vrfc_req" .
" SET tel_fail_cause = ? " .
" WHERE vr_sq = ?";
$data = array(
$tel_fail_cause,
$vr_sq
);
$res = $this->db->query($sql, $data);
echo $this->db->getLastQuery();
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
return $return;
}
/* 검증결과 전송 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 = ?";
$data = [$vr_sq];
$query = $this->db->query($sql, $data);
$row_vrfc_req = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 매물정보
$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 = ?";
$data = [$vr_sq];
$query = $this->db->query($sql, $data);
$row_article_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$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 = ?";
$data = [$vr_sq];
$query = $this->db->query($sql, $data);
$row_modify_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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 = ?";
$data = [$vr_sq, $row_vrfc_req['vrfc_type']];
$query = $this->db->query($sql, $data);
$row_confirm = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT cl_sq, vr_sq, vrfc_type, type, code, comment, ownerNm, ownerBirth insert_user, insert_tm " .
" FROM v2_check_list where vr_sq = ? and vrfc_type = ? and type like concat(vrfc_type, '%')";
$data = [$vr_sq, $row_vrfc_req['vrfc_type']];
$query = $this->db->query($sql, $data);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm));
$atclNo = $row_vrfc_req['atcl_no'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'];
$date = $row_confirm['date'];
$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' => '',
];
} else {
return array(
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
);
}
}
}

View File

@@ -248,22 +248,22 @@ class M705Model extends Model
}
// 본부
if (!empty($data['bonbu'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
} else {
$sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
}
}
// if (!empty($data['bonbu'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
// } else {
// $sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
// }
// }
// 팀
if (!empty($data['team'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept2_sq = '{$data['team']}' ";
} else {
$sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
}
}
// if (!empty($data['team'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept2_sq = '{$data['team']}' ";
// } else {
// $sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
// }
// }
// 매물종류
if (!empty($data['rlet_type_cd'])) {
@@ -479,22 +479,22 @@ class M705Model extends Model
}
// 본부
if (!empty($data['bonbu'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
} else {
$sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
}
}
// if (!empty($data['bonbu'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
// } else {
// $sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
// }
// }
// 팀
if (!empty($data['team'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept2_sq = '{$data['team']}' ";
} else {
$sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
}
}
// if (!empty($data['team'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept2_sq = '{$data['team']}' ";
// } else {
// $sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
// }
// }
// 매물종류
if (!empty($data['rlet_type_cd'])) {
@@ -526,6 +526,8 @@ class M705Model extends Model
$sql .= "LIMIT {$start}, {$end}";
// echo $sql;
$query = $this->db->query($sql);
return $query->getResultArray();
@@ -739,22 +741,22 @@ class M705Model extends Model
}
// 본부
if (!empty($data['bonbu'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
} else {
$sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
}
}
// if (!empty($data['bonbu'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept1_sq = '{$data['bonbu']}' ";
// } else {
// $sql .= "AND a.reg_dept1_sq = '{$data['bonbu']}' ";
// }
// }
// 팀
if (!empty($data['team'])) {
if ($data['charger_gbn'] === "1") {
$sql .= "AND a.dept2_sq = '{$data['team']}' ";
} else {
$sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
}
}
// if (!empty($data['team'])) {
// if ($data['charger_gbn'] === "1") {
// $sql .= "AND a.dept2_sq = '{$data['team']}' ";
// } else {
// $sql .= "AND a.reg_dept2_sq = '{$data['team']}' ";
// }
// }
// 매물종류
if (!empty($data['rlet_type_cd'])) {
@@ -1032,32 +1034,32 @@ class M705Model extends Model
$sql = "UPDATE v2_files SET use_yn = 'N' WHERE vr_sq = {$data['vr_sq']} AND use_yn = 'Y' AND file_type '2'";
$this->db->query($sql);
}
$sql = "INSERT INTO v2_files
$sql = "INSERT INTO v2_files
(vr_sq, file_type, view_odr, file_path, file_name, file_ext, file_size, insert_user, insert_tm, cloud_upload_yn)
VALUES
(?, '2', 0, ?, ?, ?, ?, ?, NOW(), 'Y')
";
$param = [
$data['vr_sq'],
$data['file_path'],
$data['new_name'],
$data['ext'],
$data['size'],
$data['usr_id'],
$param = [
$data['vr_sq'],
$data['file_path'],
$data['new_name'],
$data['ext'],
$data['size'],
$data['usr_id'],
];
if ($this->db->query($sql, $param) === false) {
return [
'success' => false,
'msg' => '파일정보 저장 실패',
];
if ($this->db->query($sql, $param)) {
return [
'success' => false,
'msg' => '파일정보 저장 실패',
];
}
}
$this->db->transComplete();
return [
@@ -1094,4 +1096,476 @@ class M705Model extends Model
return $row;
}
public function chkRegiTryCnt($atcl_vr_sq)
{
// 1차 검증인지 2차 검증인지 확인
$sql = "SELECT reg_try_cnt
FROM v2_vrfc_req
WHERE vr_sq = ?";
$query = $this->db->query($sql, [$atcl_vr_sq]);
return $query->getRowArray();
}
public function chkConfirm($atcl_vr_sq, $reg_yn)
{
// 검증결과 table에 있는지 확인.
$builder = $this->db->table('v2_confirm');
$builder->select('vr_sq');
$builder->where('vr_sq', $atcl_vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn); // 등기부등본 정보 확인시
}
$query = $builder->get();
$result = $query->getNumRows();
return $result;
}
public function getUpdateFailTime($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = '49' " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
{ //v2_confirm INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success,
'update_user' => session('usr_sq'),
'update_tm' => date('Y-m-d H:i:s')
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
$error = $this->db->error();
return [
'error_number' => $error['code'],
'error_message' => $error['message']
];
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function add_cert_uncnfrm_status($vr_sq, $cert_uncnfrm_status)
{
$builder = $this->db->table('v2_article_info');
$builder->select('vr_sq, atcl_no');
$builder->where('vr_sq', $vr_sq);
$query = $builder->get();
if ($query->getNumRows() > 0) {
$row = $query->getRowArray();
$atcl_no = $row['atcl_no'];
$sql = "INSERT INTO v2_article_info_etc (vr_sq, atcl_no, cert_uncnfrm_status)" .
" VALUES (?, ?, ?)" .
" ON DUPLICATE KEY UPDATE cert_uncnfrm_status = ?";
$data = [
$vr_sq,
$atcl_no,
$cert_uncnfrm_status,
$cert_uncnfrm_status
];
$this->db->query($sql, $data);
}
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$res = $this->db->query($sql, $data);
}
// 메모저장
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 update_owner_verifiable($vr_sq, $owner_verifiable)
{
$sql = "UPDATE v2_vrfc_req" .
" SET owner_verifiable = ?" .
" WHERE vr_sq = ?";
$data = array(
$owner_verifiable,
$vr_sq
);
$this->db->query($sql, $data);
$s = $this->db->getLastQuery();
log_message('debug', "====update_owner_verifiable====" . $s);
}
/* 등기부등본 API 호출*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, owner_verifiable" .
" FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_vrfc_req = $query->getRowArray();
if (!empty($vrfc_type)) {
$row_vrfc_req['vrfc_type'] = $vrfc_type;
}
log_message('debug', 'getDatacertApi_query => ' . $this->db->getLastQuery());
log_message('debug', 'getDatacertApi_result => ' . json_encode($row_vrfc_req));
// 매물정보
$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, vrfc_type_sub" .
" FROM v2_article_info WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_article_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
" FROM v2_check_list a" .
" INNER JOIN v2_article_info b ON a.vr_sq = b.vr_sq" .
" WHERE a.vr_sq = ? AND a.vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm));
$atclNo = $row_vrfc_req['atcl_no'];
$type = $row_vrfc_req['try_cnt'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'];
$date = $row_confirm['date'];
switch ($row_vrfc_req['owner_verifiable']) {
case "1":
case "true":
$ownerVerifiable = true;
break;
default:
$ownerVerifiable = false;
break;
}
$checkList = [];
foreach ($res_check_list as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
];
}
$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_data = [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
log_message('debug', "705 getDatacertAPI_1 {$atclNo} ::: " . json_encode($return_data) . PHP_EOL);
return $return_data;
} else {
$return_data = [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
log_message('debug', "705 getDatacertAPI_2 {$atclNo} ::: " . json_encode($return_data) . PHP_EOL);
return $return_data;
}
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
" VALUES (?, ?, ?, ?)" .
" ON DUPLICATE KEY UPDATE" .
" vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = [
$vr_sq,
$stat_cd,
$usr_sq,
$insert_tm
];
$this->db->transStart();
$this->db->query($sql, $data);
$error = $this->db->error();
$return = [
'error_number' => $error['code'],
'error_message' => $error['message']
];
if (empty($return['error_number'])) {
if ($this->db->affectedRows() > 0) {
$changed = $this->whatIsChanged($list, $data, '');
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, $changed);
}
}
}
$this->db->transComplete();
return $return;
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error_number' => $error['code'],
'error_message' => $error['message']
];
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error_number' => $error['code'],
'error_message' => $error['message']
];
}
public function updateStat($vr_sq, $reg_status)
{
$data = ['reg_status' => $reg_status];
$builder = $this->db->table('v2_article_info');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error' => [
'code' => $error['code'],
'message' => $error['message']
]
];
}
public function chgRegiTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function resetTelConf($vr_sq)
{
$sql = "update v2_check_list " .
"set code = '' " .
"where type in ('T11', 'T12', 'T13', 'T14') " .
"and vr_sq = ?";
$data = array($vr_sq);
$this->db->query($sql, $data);
}
}

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Models\v2;
use App\Models\webfax\FaxModel;
use CodeIgniter\Model;
class M706Model extends Model
@@ -757,6 +758,679 @@ class M706Model extends Model
return $query->getRowArray();
}
/* 매물정보를 수정 */
public function saveModifyInfo($atcl_vr_sq, $atcl_hscp_nm, $atcl_ptp_nm, $atcl_vrfc_type, $trade_type, $atcl_addr1, $atcl_addr1a, $atcl_addr1b, $atcl_addr2, $atcl_hscp_no, $atcl_ptp_no, $atcl_amt1, $atcl_amt2, $atcl_amt3, $atcl_floor, $atcl_floor2)
{
$session = session();
$usr_id = $session->get('usr_id');
$list = $this->getDetail($atcl_vr_sq);
$data = [];
if ($trade_type != 'B2') {
$atcl_amt3 = '0';
$data['lease_amt'] = $atcl_amt3;
}
if (!empty($trade_type))
$data['trade_type'] = $trade_type;
if (!empty($atcl_hscp_nm))
$data['hscp_nm'] = $atcl_hscp_nm;
if (!empty($atcl_ptp_nm))
$data['ptp_nm'] = $atcl_ptp_nm;
if (!empty($atcl_addr1))
$data['address2'] = $atcl_addr1;
if (!empty($atcl_addr1a))
$data['address2a'] = $atcl_addr1a;
if (!empty($atcl_addr1b))
$data['address2b'] = $atcl_addr1b;
if (!empty($atcl_addr2))
$data['address3'] = $atcl_addr2;
if (!empty($atcl_hscp_no))
$data['hscp_no'] = $atcl_hscp_no;
if (!empty($atcl_ptp_no))
$data['ptp_no'] = $atcl_ptp_no;
if (!empty($atcl_amt1))
$data['deal_amt'] = $atcl_amt1;
if (!empty($atcl_amt2))
$data['wrrnt_amt'] = $atcl_amt2;
if (!empty($atcl_amt3))
$data['lease_amt'] = $atcl_amt3;
if (!empty($atcl_floor))
$data['floor'] = $atcl_floor;
if (!empty($atcl_floor2))
$data['floor2'] = $atcl_floor2;
$data['modify_yn'] = 'Y';
$this->db->transStart();
$builder = $this->db->table('v2_modify_info');
$builder->where('vr_sq', $atcl_vr_sq);
$builder->update($data);
$last_query = $this->db->getLastQuery();
$current_url = current_url();
log_message('debug', $current_url . ' :: ' . $last_query);
$data['trade_type_cd'] = $trade_type;
$return['error_number'] = $this->db->error()['code'];
$return['error_message'] = $this->db->error()['message'];
if (empty($return['error_number'])) {
if ($this->db->affectedRows() > 0) {
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $list['pre_stat_cd'], 'C25', $usr_id, "매물정보 수정");
}
}
}
$this->db->transComplete();
// 홍보확인서인 경우 주소 변경시 FAX 이미지의 정보도 함께 변경한다.
$faxModel = new FaxModel();
$faxModel->updateAddress($atcl_vr_sq, $list['address_code'], $data['address2'] ?? '', $data['address3'] ?? '', $data['hscp_no'] ?? '', $data['hscp_nm'] ?? '');
return $return;
}
public function saveModifyVrfc($atcl_vr_sq, $atcl_vrfc_type)
{
$usr_id = session('usr_id');
$list = $this->getDetail($atcl_vr_sq); //변경된 내용 비교를 위해.
$data['vrfc_type'] = $atcl_vrfc_type;
$this->db->where('vr_sq', $atcl_vr_sq);
$this->db->trans_start();
$this->db->update('v2_vrfc_req', $data);
$data['vrfc_type_cd'] = $atcl_vrfc_type;
//echo $this->db->last_query();
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affected_rows() > 0) {
if (!empty($changed)) {
$this->saveChangedHistory($list['data']['vr_sq'], $list['data']['pre_stat_cd'], 'C25', $usr_id, "매물정보 저장");
}
}
}
$this->db->trans_complete();
return $return;
}
/* 현재 상태 확인 */
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function InsCharger($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function chkTryCnt($atcl_vr_sq)
{
// 1차 검증인지 2차 검증인지 확인.
$builder = $this->db->table('v2_vrfc_req');
$builder->select('try_cnt');
$builder->where('vr_sq', $atcl_vr_sq);
$query = $builder->get();
return $query->getRowArray();
}
public function chkConfirm($atcl_vr_sq, $reg_yn = null)
{
// 검증결과 table에 있는지 확인.
$builder = $this->db->table('v2_confirm');
$builder->select('vr_sq');
$builder->where('vr_sq', $atcl_vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn); // 등기부등본 정보 확인시
}
$query = $builder->get();
return $query->getNumRows();
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
{ //v2_confirm INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success,
'update_tm' => date('Y-m-d H:i:s')
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
$return = [
'error_number' => $this->db->error()['code'],
'error_message' => $this->db->error()['message']
];
return $return;
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{
// 상태변경 TABLE INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm) " .
"VALUES (?, ?, ?, ?) " .
"ON DUPLICATE KEY UPDATE " .
"vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = [
$vr_sq,
$stat_cd,
$usr_sq,
$insert_tm
];
$this->db->transStart();
$query = $this->db->query($sql, $data);
$last_query = $this->db->getLastQuery();
log_message('debug', $last_query);
$return['error_number'] = $this->db->error()['code'];
$return['error_message'] = $this->db->error()['message'];
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affectedRows() > 0) {
$changed = $this->whatIsChanged($list, $data, '');
if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, $changed);
}
}
}
$this->db->transComplete();
return $return;
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$last_query = $this->db->getLastQuery();
log_message('debug', $last_query);
$return['error_number'] = $this->db->error()['code'];
$return['error_message'] = $this->db->error()['message'];
return $return;
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$last_query = $this->db->getLastQuery();
log_message('debug', $last_query);
$return['error_number'] = $this->db->error()['code'];
$return['error_message'] = $this->db->error()['message'];
return $return;
}
public function chgTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$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();
log_message('debug', $this->db->getLastQuery());
// 매물정보
$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();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$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();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$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();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm));
$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,
];
} else {
return [
'atclNo' => $atclNo,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'try_cnt' => $try_cnt,
];
}
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function chkRegiTryCnt($atcl_vr_sq)
{
// 1차 검증인지 2차 검증인지 확인.
$builder = $this->db->table('v2_vrfc_req');
$builder->select('reg_try_cnt');
$builder->where('vr_sq', $atcl_vr_sq);
$query = $builder->get();
$last_query = $this->db->getLastQuery();
log_message('debug', $last_query);
return $query->getRowArray();
}
/* 등기부등본 API 호출*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, owner_verifiable" .
" FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_vrfc_req = $query->getRowArray();
if (!empty($vrfc_type)) {
$row_vrfc_req['vrfc_type'] = $vrfc_type;
}
log_message('debug', $this->db->getLastQuery());
// 매물정보
$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();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
" FROM v2_check_list a " .
" INNER JOIN v2_article_info b ON a.vr_sq = b.vr_sq" .
" WHERE a.vr_sq = ? AND a.vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm));
$atclNo = $row_vrfc_req['atcl_no'];
$type = $row_vrfc_req['try_cnt'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'];
$date = $row_confirm['date'];
$ownerVerifiable = ($row_vrfc_req['owner_verifiable'] === 'false') ? false : true;
$checkList = [];
foreach ($res_check_list as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
];
}
$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,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
];
} else {
return [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'ownerVerifiable' => $ownerVerifiable,
];
}
}
// 메모저장
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 saveApiErr($err_sq, $err_code, $err_nm, $err_time, $err_no, $err_server = '')
{
$sql = "INSERT INTO err_api (err_sq, err_code, err_nm, err_time, err_no, err_server)" .
" VALUES (?, ?, ?, ?, ?, ?);";
$data = array(
$err_sq,
$err_code,
$err_nm,
$err_time,
$err_no,
$err_server
);
$this->db->query($sql, $data);
}
// 정보변경 이력 저장
public function saveChangedHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)
{
$sql = "INSERT INTO v2_chg_history" .
" (vr_sq, stat_cd, chg_type, insert_id, insert_tm, memo)" .
" VALUES" .
" (?, ?, ?, ?, now(), ?)";
$data = [
$vr_sq,
$stat_cd,
$chg_type,
$usr_id,
$memo
];
$res = $this->db->query($sql, $data);
}
// 변경이력 조회
public function getHistory($id)
{

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)

View File

@@ -704,4 +704,19 @@ class M710Model extends Model
}
public function get_send_yn($type)
{
$sql = "SELECT stop_yn
FROM v2_stop_api_chg_stat
WHERE TYPE = ?
ORDER BY pk DESC
LIMIT 1";
$date = array(
$type
);
$query = $this->db->query($sql, $date);
$return = $query->getRowArray();
return $return;
}
}

View File

@@ -906,6 +906,504 @@ class M712Model extends Model
}
}
/* 현재 상태 확인 */
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
//1차 검증인지 2차 검증인지 확인.
public function chkRegiTryCnt($atcl_vr_sq)
{
$sql = "SELECT reg_try_cnt FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$atcl_vr_sq]);
return $query->getRowArray();
}
//검증결과 table에 있는지 확인.
public function chkConfirm($atcl_vr_sq, $reg_yn)
{
$builder = $this->db->table('v2_confirm a');
$builder->select('a.vr_sq');
$builder->where('vr_sq', $atcl_vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn);
}
$query = $builder->get();
return $query->getNumRows();
}
public function getUpdateFailTime($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = '49' " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
//v2_confirm INSERT
public function insertConfirm($vr_sq, $vrfc_type, $success, $type, $usr_id = '', $usr_sq = '')
{
if (empty($usr_sq))
$usr_sq = session('usr_sq');
if (empty($usr_id))
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, 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)";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success)
{
$data = [
'success' => $success,
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
return [
'error_number' => $this->db->error()['code'],
'error_message' => $this->db->error()['message']
];
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
//echo $this->db->last_query();
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function add_cert_uncnfrm_status($vr_sq, $cert_uncnfrm_status)
{
$sql = "UPDATE v2_article_info_etc" .
" SET cert_uncnfrm_status = ?" .
" WHERE vr_sq = ?";
$data = array(
$cert_uncnfrm_status,
$vr_sq
);
$this->db->query($sql, $data);
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$this->db->query($sql, $data);
}
/**
* update updatedocument_cert_method
*/
public function updatedocument_cert_method($vr_sq, $document_cert_method)
{
$sql = "UPDATE v2_article_info_etc SET " .
" document_cert_method = ? " .
" WHERE vr_sq = ? ";
$document_cert_method = json_encode($document_cert_method, JSON_UNESCAPED_UNICODE);
if ($document_cert_method == 'false') {
$document_cert_method = NULL;
}
$data = array(
$document_cert_method,
$vr_sq
);
$this->db->query($sql, $data);
$s = $this->db->getLastQuery();
log_message('debug', "====updatedocument_cert_method:712====" . $s);
}
public function update_owner_verifiable($vr_sq, $owner_verifiable)
{
$sql = "UPDATE v2_vrfc_req" .
" SET owner_verifiable = ?" .
" WHERE vr_sq = ?";
$data = array(
$owner_verifiable,
$vr_sq
);
$this->db->query($sql, $data);
$s = $this->db->getLastQuery();
log_message('debug', "====update_owner_verifiable:712====" . $s);
}
/* 등기부등본 API 호출*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, owner_verifiable" .
" FROM v2_vrfc_req where vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_vrfc_req = $query->getRowArray();
if (!empty($vrfc_type)) {
$row_vrfc_req['vrfc_type'] = $vrfc_type;
}
log_message('debug', 'getDatacertApi_query => ' . $this->db->getLastQuery());
log_message('debug', 'getDatacertApi_result => ' . json_encode($row_vrfc_req));
// 매물정보
$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, vrfc_type_sub" .
" FROM v2_article_info where vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_article_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
" FROM v2_check_list a " .
" INNER JOIN v2_article_info b on a.vr_sq = b.vr_sq" .
" WHERE a.vr_sq = ? and a.vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm ?? []));
$atclNo = $row_vrfc_req['atcl_no'];
$type = $row_vrfc_req['try_cnt'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'] ?? '';
$date = $row_confirm['date'] ?? '';
switch ($row_vrfc_req['owner_verifiable']) {
case "1":
case "true":
$ownerVerifiable = true;
break;
default:
$ownerVerifiable = false;
break;
}
$checkList = [];
foreach ($res_check_list as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
];
}
$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,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
} else {
return [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
}
}
public function get_send_yn($type)
{
$sql = "SELECT stop_yn
FROM v2_stop_api_chg_stat
WHERE TYPE = ?
ORDER BY pk DESC
LIMIT 1";
$date = array(
$type
);
$query = $this->db->query($sql, $date);
$return = $query->getRowArray();
return $return;
}
public function insert_v2_stop_api_save_info($atcl_no, $vr_sq, $type, $fax_sq)
{
$sql = "INSERT INTO v2_stop_api_save_info(atcl_no,vr_sq,type,status,stop_dt,fax_sq)" .
" VALUE(?,?,?,'stop',now(),?)";
$date = array(
$atcl_no,
$vr_sq,
$type,
$fax_sq
);
$this->db->query($sql, $date);
}
/**
* 712 소유자 확인 을 위한 쿼리
*/
public function getOwnerVerifiable($atcl_no)
{
$sql = "select * ,
case
when owner_verifiable = 'true' then '1'
when owner_verifiable = '1' then '1'
when owner_verifiable = 'false' then '0'
when owner_verifiable = '0' then '0'
ELSE null
END AS OwnerVerifiable_change
from v2_vrfc_req where atcl_no = ? ";
$data = array(
$atcl_no
);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{ //상태변경 TABLE INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->get_detail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
"VALUES (?, ?, ?, ?)" .
"ON DUPLICATE KEY " .
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = array(
'vr_sq' => $vr_sq,
'stat_cd' => $stat_cd,
'usr_sq' => $usr_sq,
'insert_tm' => $insert_tm
);
$this->db->transStart();
$res = $this->db->query($sql, $data);
$return['error_number'] = $this->db->_error_number();
$return['error_message'] = $this->db->_error_message();
if (empty($return['error_number'])) {
//로그를 남긴다.
if ($this->db->affected_rows() > 0) {
if (!empty($changed)) {
$this->saveChangedHistory($list['data']['vr_sq'], $stat_cd, 'C9', $usr_id, "상태변경 저장"); //검증결과 변동사항 HISTORY
}
}
}
$this->db->transComplete();
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
return [
'error_number' => $this->db->error()['code'],
'error_message' => $this->db->error()['message']
];
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
return [
'error_number' => $this->db->error()['code'],
'error_message' => $this->db->error()['message']
];
}
//v2_vrfc_req try_cnt 값 변경.
public function chgRegiTryCnt($vr_sq, $try_cnt)
{
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$res = $this->db->query($sql, $data);
}
public function resetTelConf($vr_sq)
{
$sql = "update v2_check_list " .
"set code = '' " .
"where type in ('T11', 'T12', 'T13', 'T14') " .
"and vr_sq = ?";
$data = array($vr_sq);
$this->db->query($sql, $data);
}
// 메모저장
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 saveChangedHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)

View File

@@ -930,6 +930,535 @@ class M713Model extends Model
}
}
/* 현재 상태 확인 */
public function chkStat($vr_sq)
{
$sql = "SELECT stat_cd FROM v2_vrfc_req WHERE vr_sq = ?";
$data = array(
$vr_sq
);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function chkTryCnt($atcl_vr_sq)
{
// 1차 검증인지 2차 검증인지 확인.
$sql = "SELECT a.try_cnt FROM v2_vrfc_req a WHERE vr_sq = ?";
$query = $this->db->query($sql, [$atcl_vr_sq]);
return $query->getRowArray();
}
public function chkRegiTryCnt($atcl_vr_sq)
{
$sql = "SELECT a.reg_try_cnt FROM v2_vrfc_req a WHERE vr_sq = ?";
$query = $this->db->query($sql, [$atcl_vr_sq]);
return $query->getRowArray();
}
public function chkConfirm($atcl_vr_sq, $reg_yn)
{
// 검증결과 table에 있는지 확인.
$builder = $this->db->table('v2_confirm a');
$builder->select('a.vr_sq');
$builder->where('vr_sq', $atcl_vr_sq);
if ($reg_yn) {
$builder->where('vrfc_type', $reg_yn); // 등기부등본 정보 확인시
}
$query = $builder->get();
$result = $query->getNumRows();
return $result;
}
public function getUpdateFailTime($vr_sq)
{
$sql = "select vr_sq, stat_cd, insert_user, insert_tm " .
"from v2_chg_stat " .
"where vr_sq = ? and stat_cd = '49' " .
"order by insert_tm desc " .
"limit 1";
$data = array($vr_sq);
$query = $this->db->query($sql, $data);
$row = $query->getRowArray();
return $row;
}
public function insertConfirm($vr_sq, $vrfc_type, $success, $type)
{ //v2_confirm INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$sql = "INSERT INTO v2_confirm" .
"(vr_sq, vrfc_type, success, type, charger, date, insert_user, insert_tm, update_user, update_tm)" .
"VALUES" .
"(?, ?, ?, ?, ?, '" . date('YmdHis') . "', ?, NOW(), ?, NOW())";
$data = array(
$vr_sq,
$vrfc_type,
$success,
$type,
$usr_id,
$usr_sq,
$usr_sq
);
$res = $this->db->query($sql, $data);
}
public function updateConfirm($vr_sq, $vrfc_type, $success): void
{
$data = [
'success' => $success
];
$builder = $this->db->table('v2_confirm');
$builder->where('vr_sq', $vr_sq);
$builder->where('vrfc_type', $vrfc_type);
$builder->update($data);
}
public function InsResChar($atcl_vr_sq)
{
$usr_id = session('usr_id');
$sql = "UPDATE v2_article_info" .
" SET reg_charger = ?" .
" WHERE vr_sq = ?";
$data = array(
$usr_id,
$atcl_vr_sq
);
//echo $this->db->last_query();
$res = $this->db->query($sql, $data);
$log_v = $this->db->getLastQuery();
log_message('debug', $log_v);
}
public function add_cert_uncnfrm_status($vr_sq, $cert_uncnfrm_status)
{
$sql = "UPDATE v2_article_info_etc" .
" SET cert_uncnfrm_status = ?" .
" WHERE vr_sq = ?";
$data = array(
$cert_uncnfrm_status,
$vr_sq
);
$this->db->query($sql, $data);
}
public function insertChkList($vr_sq, $vrfc_type, $type, $code, $comment)
{ //v2_check_list INSERT
$usr_sq = session('usr_sq');
$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,
$vrfc_type,
$type,
$code,
$comment,
$usr_sq
);
$res = $this->db->query($sql, $data);
}
public function update_owner_verifiable($vr_sq, $owner_verifiable)
{
$sql = "UPDATE v2_vrfc_req" .
" SET owner_verifiable = ?" .
" WHERE vr_sq = ?";
$data = array(
$owner_verifiable,
$vr_sq
);
$this->db->query($sql, $data);
$s = $this->db->getLastQuery();
log_message('debug', "====update_owner_verifiable====" . $s);
}
/* 등기부등본 API 호출*/
public function getDatacertAPI($vr_sq, $vrfc_type = '')
{
// 요청정보
$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, owner_verifiable" .
" FROM v2_vrfc_req WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_vrfc_req = $query->getRowArray();
if (!empty($vrfc_type)) {
$row_vrfc_req['vrfc_type'] = $vrfc_type;
}
log_message('debug', 'getDatacertApi_query => ' . $this->db->getLastQuery());
log_message('debug', 'getDatacertApi_result => ' . json_encode($row_vrfc_req));
// 매물정보
$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, vrfc_type_sub" .
" FROM v2_article_info WHERE vr_sq = ?";
$query = $this->db->query($sql, [$vr_sq]);
$row_article_info = $query->getRowArray();
log_message('debug', $this->db->getLastQuery());
// 수정정보
$sql = "SELECT vr_sq, bild_nm, rm_no, floor, address_code, address2, address3, 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();
log_message('debug', $this->db->getLastQuery());
// 검증결과
$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();
log_message('debug', $this->db->getLastQuery());
// 확인정보
$sql = "SELECT a.type, a.code, a.comment, b.ownerNm, b.owner_birth" .
" FROM v2_check_list a" .
" INNER JOIN v2_article_info b ON a.vr_sq = b.vr_sq" .
" WHERE a.vr_sq = ? AND a.vrfc_type = ?";
$query = $this->db->query($sql, [$vr_sq, $row_vrfc_req['vrfc_type']]);
$res_check_list = $query->getResultArray();
log_message('debug', $this->db->getLastQuery());
log_message('debug', implode(', ', $row_confirm ?? []));
$atclNo = $row_vrfc_req['atcl_no'];
$type = $row_vrfc_req['try_cnt'];
$success = empty($row_confirm['success']) ? false : true;
$charger = $row_confirm['charger'] ?? '';
$date = $row_confirm['date'] ?? '';
$ownerVerifiable = match ($row_vrfc_req['owner_verifiable']) {
"1", "true" => true,
default => false,
};
$checkList = [];
foreach ($res_check_list as $row) {
$checkList[] = [
'type' => $row['type'],
'code' => $row['code'],
'comment' => $row['comment'],
'ownerNm' => $row['ownerNm'],
'ownerBirth' => $row['owner_birth'],
];
}
$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_data = [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'modifyInfo' => $modifyInfo,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
log_message('debug', "713 getDatacertAPI_1 {$atclNo} ::: " . json_encode($return_data) . PHP_EOL);
return $return_data;
} else {
$return_data = [
'atclNo' => $atclNo,
'type' => $type,
'success' => $success,
'checkList' => $checkList,
'charger' => $charger,
'date' => $date,
'vrfcType' => $row_article_info['vrfc_type_sub'],
'ownerVerifiable' => $ownerVerifiable,
];
log_message('debug', "713 getDatacertAPI_2 {$atclNo} ::: " . json_encode($return_data) . PHP_EOL);
return $return_data;
}
}
public function chgStat($vr_sq, $stat_cd, $insert_tm)
{
// 상태변경 TABLE INSERT
$usr_sq = session('usr_sq');
$usr_id = session('usr_id');
$list = $this->getDetail($vr_sq);
$sql = "INSERT INTO v2_chg_stat (vr_sq, stat_cd, insert_user, insert_tm)" .
"VALUES (?, ?, ?, ?)" .
"ON DUPLICATE KEY " .
"UPDATE vr_sq=VALUES(vr_sq), stat_cd=VALUES(stat_cd), insert_user=VALUES(insert_user), insert_tm=VALUES(insert_tm)";
$data = [
$vr_sq,
$stat_cd,
$usr_sq,
$insert_tm
];
$this->db->transStart();
$this->db->query($sql, $data);
$error = $this->db->error();
$return = [
'error_number' => $error['code'],
'error_message' => $error['message']
];
if (empty($return['error_number'])) {
// 로그를 남긴다.
if ($this->db->affectedRows() > 0) {
// $changed = $this->what_is_changed($list, $data, '');
// if (!empty($changed)) {
$this->saveChangedHistory($list['vr_sq'], $stat_cd, 'C9', $usr_id, "상태변경 저장");
// }
}
}
$this->db->transComplete();
return $return;
}
public function chgStatVrfc($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('v2_vrfc_req');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error_number' => $error['code'],
'error_message' => $error['message']
];
}
public function chgStatFax($vr_sq, $stat_cd)
{
$data = ['stat_cd' => $stat_cd];
$builder = $this->db->table('fax_imgs');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error_number' => $error['code'],
'error_message' => $error['message']
];
}
public function updateStat($vr_sq, $reg_status)
{
$data = ['reg_status' => $reg_status];
$builder = $this->db->table('v2_article_info');
$builder->where('vr_sq', $vr_sq);
$builder->update($data);
$error = $this->db->error();
return [
'error' => [
'code' => $error['code'],
'message' => $error['message']
]
];
}
public function chgRegiTryCnt($vr_sq, $try_cnt)
{ //v2_vrfc_req try_cnt 값 변경.
$sql = "UPDATE v2_vrfc_req" .
" SET reg_try_cnt = ?" .
" WHERE vr_sq = ?";
$data = array(
$try_cnt,
$vr_sq
);
$this->db->query($sql, $data);
}
public function modify_info($vr_sq, $owner_birth, $address2, $address2a, $address2b, $address3, $address4, $address_code, $hscp_no, $hscp_nm)
{
$this->db->transStart();
$usr_id = session('usr_id');
$sql = "UPDATE v2_modify_info
SET address2 = ?
,address2a = ?
,address2b = ?
,address3 = ?
,address4 = ?
,address_code = ?
,hscp_no = ?
,hscp_nm = ?
,modify_yn = 'Y'
WHERE vr_sq = ?";
$data = array(
$address2,
$address2a,
$address2b,
$address3,
$address4,
$address_code,
$hscp_no,
$hscp_nm,
$vr_sq
);
if ($this->db->query($sql, $data) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$sql2 = "UPDATE v2_article_info
SET owner_birth = ?
,address2 = ?
,address3 = ?
,address_code = ?
,hscp_no = ?
,hscp_nm = ?
WHERE vr_sq = ?";
$data2 = array(
$owner_birth,
$address2,
$address3,
$address_code,
$hscp_no,
$hscp_nm,
$vr_sq
);
if ($this->db->query($sql2, $data2) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$sql3 = "UPDATE v2_article_info_etc
SET address2a = ?
,address2b = ?
WHERE vr_sq = ?";
$data3 = array(
$address2a,
$address2b,
$vr_sq
);
if ($this->db->query($sql3, $data) === false) {
return [
'success' => false,
'msg' => '저장 실패',
];
}
$this->saveChangedHistory($vr_sq, '40', 'C34', $usr_id, '생년월일 정보 변경');
$this->db->transComplete();
return [
'success' => true,
];
}
// 메모저장
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 saveChangedHistory($vr_sq, $stat_cd, $chg_type, $usr_id, $memo)

View File

@@ -5,6 +5,19 @@ use CodeIgnier\Model;
class FaxModel extends Model
{
/**
* FAX 내용중 하나만 가져오기
*/
public function selectFax($faxSq)
{
$sql = "SELECT mid, caller_no, recv_time, fax_sq, file_path, file_name, thumbnail, img_width, img_height, img_size" .
" FROM fax_imgs" .
" WHERE fax_sq = ?";
$data = array($faxSq);
$query = $this->db->query($sql, $data);
return $query->getRowArray();
}
public function selectFaxListNotExistsThumb()
{
helper('cron');

View File

@@ -0,0 +1,89 @@
<?php
namespace App\Services\Handlers;
use CodeIgniter\CLI\CLI;
use App\Services\ParameterMapper\TypeSParameterMapper;
use App\Models\Entities\ReceiptModel;
use App\Models\Entities\ResultModel;
use App\Models\Entities\NaverRawStagingModel;
use Exception;
/**
* Type S 핸들러
* 현장확인 매물 (A01) 데이터 처리
*/
class TypeSHandler
{
private $receiptModel;
private $resultModel;
private $stagingModel;
private $db;
private $parameterMapper;
private $naverClient;
public function __construct()
{
$this->db = \Config\Database::connect();
$this->receiptModel = new ReceiptModel();
$this->resultModel = new ResultModel();
$this->stagingModel = new NaverRawStagingModel();
$this->parameterMapper = new TypeSParameterMapper();
$this->naverClient = new \App\Libraries\NaverApiClient();
helper('log');
}
/**
* Type S 메인 처리 로직
*/
public function handle(string $articleNumber, array $rawData, array $payload): int
{
CLI::write(CLI::color('🟢 Type S 처리 시작 :: ' . $articleNumber, 'green'));
$this->db->transBegin();
try {
// 1. Receipt 데이터 저장
$receiptData = $this->parameterMapper->mapReceipt($articleNumber, $rawData, $payload);
if (!$this->receiptModel->insert($receiptData)) {
throw new Exception("Receipt Insert 실패: " . json_encode($this->receiptModel->errors()));
}
$rcptSq = $this->receiptModel->getInsertID();
CLI::write(CLI::color("✅ Receipt 저장 성공 (ID: $rcptSq)", 'blue'));
// 2. Result 데이터 저장
$resultData = $this->parameterMapper->mapResult($rcptSq, $rawData);
if (!$this->resultModel->insert($resultData)) {
throw new Exception("Result Insert 실패");
}
CLI::write(CLI::color('✅ Result 저장 성공', 'blue'));
// 3. 트랜잭션 커밋
$this->db->transComplete();
if ($this->db->transStatus() === false) {
write_custom_log("Type S DB 트랜잭션 최종 실패", 'ERROR', 'service');
throw new Exception("Type S DB 트랜잭션 최종 실패");
}
// 4. 로그 기록
write_custom_log("Type S 처리 성공 | Atcl: $articleNumber | Rcpt_sq: $rcptSq", 'INFO', 'service');
write_custom_log("Receipt Insert SQL: " . (string)$this->receiptModel->getLastQuery(), 'INFO', 'service');
write_custom_log("Result Insert SQL: " . (string)$this->resultModel->getLastQuery(), 'INFO', 'service');
// 5. 네이버 예약 정보 동기화 (비동기)
try {
$syncResult = $this->naverClient->submitSyncResult($rawData['reserveNo'] ?? '');
write_custom_log("Naver Sync Result Response: " . json_encode($syncResult), 'INFO', 'service');
} catch (Exception $e) {
write_custom_log("Naver Sync 실패 (계속 진행): " . $e->getMessage(), 'WARN', 'service');
}
return $rcptSq;
} catch (Exception $e) {
$this->db->transRollback();
write_custom_log("Type S 처리 실패: " . $e->getMessage(), 'ERROR', 'service');
throw $e;
}
}
}

View File

@@ -0,0 +1,317 @@
<?php
namespace App\Services\Handlers;
use CodeIgniter\CLI\CLI;
use App\Services\ParameterMapper\TypeV2ParameterMapper;
use App\Models\Entities\VrfcReqModel;
use App\Models\Entities\V2articleinfoModel;
use App\Models\Entities\V2articleinfoetcModel;
use App\Models\Entities\V2modifyinfoModel;
use App\Models\Entities\V2urlimgsaveModel;
use App\Services\StatusService;
use Exception;
/**
* Type V2 핸들러
* 일반/서류/비공동 매물 (D04, F01 등) 데이터 처리
*/
class TypeV2Handler
{
private $vrfcReqModel;
private $articleInfoModel;
private $articleInfoEtcModel;
private $modifyInfoModel;
private $urlImgSaveModel;
private $statusService;
private $db;
private $parameterMapper;
public function __construct()
{
$this->db = \Config\Database::connect();
$this->vrfcReqModel = new VrfcReqModel();
$this->articleInfoModel = new V2articleinfoModel();
$this->articleInfoEtcModel = new V2articleinfoetcModel();
$this->modifyInfoModel = new V2modifyinfoModel();
$this->urlImgSaveModel = new V2urlimgsaveModel();
$this->statusService = new StatusService();
$this->parameterMapper = new TypeV2ParameterMapper();
helper('log');
}
/**
* Type V2 메인 처리 로직
*/
public function handle(string $articleNumber, array $rawData, array $payload): int
{
CLI::write(CLI::color('🟢 Type V2 처리 시작 :: ' . $articleNumber, 'green'));
try {
$requestType = $payload['requestType'] ?? 'REG';
switch ($requestType) {
case 'REG':
return $this->handleRegister($articleNumber, $rawData, $payload);
case 'MOD':
return $this->handleModify($articleNumber, $rawData, $payload);
case 'CNC':
return $this->handleCancel($articleNumber, $rawData, $payload);
default:
throw new Exception("알 수 없는 requestType: $requestType");
}
} catch (Exception $e) {
write_custom_log("Type V2 처리 실패: " . $e->getMessage(), 'ERROR', 'service');
throw $e;
}
}
/**
* 신규 등록 처리
*/
private function handleRegister(string $articleNumber, array $rawData, array $payload): int
{
CLI::write(CLI::color('🔵 V2 신규 등록 시작', 'cyan'));
// 파라미터 준비
$vrfcReqParam = $this->parameterMapper->mapVrfcReq($articleNumber, $rawData, $payload);
$articleInfoParam = $this->parameterMapper->mapArticleInfo($articleNumber, $rawData, $payload);
$articleInfoEtcParam = $this->parameterMapper->mapArticleInfoEtc($articleNumber, $rawData);
$modifyInfoParam = $this->parameterMapper->mapModifyInfo($articleNumber, $rawData, $payload);
// 검증 요청 저장 또는 업데이트
$vrSq = $this->insertOrUpdateVrfcReq($vrfcReqParam);
// 기사 정보 저장
$articleInfoParam['vr_sq'] = $vrSq;
if (!$this->articleInfoModel->replace($articleInfoParam)) {
throw new Exception("ArticleInfo Insert 실패: " . json_encode($this->db->error()));
}
CLI::write(CLI::color('✅ ArticleInfo 저장 성공', 'blue'));
// 기사 정보 추가 저장
$articleInfoEtcParam['vr_sq'] = $vrSq;
if (!$this->articleInfoEtcModel->replace($articleInfoEtcParam)) {
CLI::write(CLI::color('❌ ArticleInfoEtc 저장 실패 :: ' . json_encode($articleInfoEtcParam), 'red'));
throw new Exception("ArticleInfoEtc Insert 실패: " . json_encode($this->db->error()));
}
CLI::write(CLI::color('✅ ArticleInfoEtc 저장 성공', 'blue'));
// 수정 정보 입력 (있으면 update, 없으면 insert)
$modifyInfoParam['vr_sq'] = $vrSq;
$sql = $this->modifyInfoModel->builder()->set($modifyInfoParam)->getCompiledInsert();
CLI::write(CLI::color("\n[생성된 쿼리 예상안]:", 'yellow'));
CLI::write($sql);
if (!$this->modifyInfoModel->replace($modifyInfoParam)) {
CLI::write(CLI::color('❌ modifyInfoParam 저장 실패 :: ' . json_encode($modifyInfoParam), 'red'));
throw new Exception("ModifyInfo 저장 실패: " . json_encode($this->db->error() . " sql: " . $this->modifyInfoModel->getLastQuery()));
}
CLI::write(CLI::color('✅ ModifyInfo 저장 성공', 'blue'));
// URL 이미지 저장 (v2_url_img_save 테이블)
$files = $rawData['files'] ?? [];
if (!empty($files)) {
$fileExtracted = $this->parameterMapper->extractFilesByType($files);
$this->saveUrlImagesToDb($fileExtracted, $articleNumber, $vrSq);
}
// 상태 기록
$this->statusService->recordStatusAndHistory($vrSq, '10', 'C9', "NEW 신규접수 : 10");
write_custom_log("V2 신규 등록 성공 | Atcl: $articleNumber | VR_SQ: $vrSq", 'INFO', 'service');
return $vrSq;
}
/**
* 수정 처리
*/
private function handleModify(string $articleNumber, array $rawData, array $payload): int
{
CLI::write(CLI::color('🔵 V2 수정 시작', 'cyan'));
// 기존 검증 요청 확인
$existing = $this->vrfcReqModel->where('atcl_no', $articleNumber)->first();
if (!$existing) {
throw new Exception("수정할 기존 데이터가 없습니다. Atcl: $articleNumber");
}
$vrSq = $existing['vr_sq'];
$stat_cd = $existing['stat_cd'];
// 파라미터 준비 (MOD 타입)
$vrfcReqParam = $this->parameterMapper->mapVrfcReq($articleNumber, $rawData, $payload);
$articleInfoParam = $this->parameterMapper->mapArticleInfo($articleNumber, $rawData, $payload);
$articleInfoEtcParam = $this->parameterMapper->mapArticleInfoEtc($articleNumber, $rawData);
$modifyInfoParam = $this->parameterMapper->mapModifyInfo($articleNumber, $rawData, $payload);
$vrfcReqParam['stat_cd'] = '30';
$vrfcReqParam['insert_tm'] = date('Y-m-d H:i:s');
$vrfcReqParam['sync_yn'] = 'Y';
// 데이터 업데이트
if (!$this->vrfcReqModel->update($vrSq, $vrfcReqParam)) {
throw new Exception("VrfcReq Update 실패");
}
// 기사 정보 저장
$articleInfoParam['vr_sq'] = $vrSq;
if (!$this->articleInfoModel->replace($articleInfoParam)) {
throw new Exception("ArticleInfo Insert 실패: " . json_encode($this->db->error()));
}
CLI::write(CLI::color('✅ ArticleInfo 저장 성공', 'blue'));
// 기사 정보 추가 저장
$articleInfoEtcParam['vr_sq'] = $vrSq;
if (!$this->articleInfoEtcModel->replace($articleInfoEtcParam)) {
throw new Exception("ArticleInfoEtc Insert 실패: " . json_encode($this->db->error()));
}
CLI::write(CLI::color('✅ ArticleInfoEtc 저장 성공', 'blue'));
// 수정 정보 입력 (있으면 update, 없으면 insert)
if (!$this->modifyInfoModel->saveModifyInfo($vrSq, $modifyInfoParam)) {
throw new Exception("ModifyInfo 저장 실패: " . json_encode($this->db->error()));
}
CLI::write(CLI::color('✅ ModifyInfo 저장 성공', 'blue'));
// URL 이미지 저장 (v2_url_img_save 테이블)
$files = $rawData['files'] ?? [];
if (!empty($files)) {
$fileExtracted = $this->parameterMapper->extractFilesByType($files);
$this->saveUrlImagesToDb($fileExtracted, $articleNumber, $vrSq);
}
$this->statusService->recordStatusAndHistory($vrSq, '30', 'C9', "재접수 상태변경 : {$stat_cd} => 30");
CLI::write(CLI::color('✅ VrfcReq 수정 성공', 'blue'));
return $vrSq;
}
/**
* 취소 처리
*/
private function handleCancel(string $articleNumber, array $rawData, array $payload): int
{
CLI::write(CLI::color('🔵 V2 취소 시작', 'cyan'));
// 기존 검증 요청 확인
$existing = $this->vrfcReqModel->where('atcl_no', $articleNumber)->first();
if (!$existing) {
throw new Exception("취소할 기존 데이터가 없습니다. Atcl: $articleNumber");
}
$vrSq = $existing['vr_sq'];
$stat_cd = $existing['stat_cd'];
// 파라미터 준비 (MOD 타입)
$vrfcReqParam = $this->parameterMapper->mapVrfcReq($articleNumber, $rawData, $payload);
$vrfcReqParam['stat_cd'] = '19';
$vrfcReqParam['insert_tm'] = date('Y-m-d H:i:s');
$vrfcReqParam['req_type'] = 'D';
// 상태를 취소로 업데이트
if (!$this->vrfcReqModel->update($vrSq, $vrfcReqParam)) {
throw new Exception("VrfcReq Cancel 실패");
}
$this->statusService->recordStatusAndHistory($vrSq, '19', 'C9', "재접수 상태변경 : {$stat_cd} => 19");
CLI::write(CLI::color('✅ 취소 처리 완료', 'blue'));
write_custom_log("V2 취소 성공 | Atcl: $articleNumber | VR_SQ: $vrSq", 'INFO', 'service');
return $vrSq;
}
/**
* 검증 요청 저장 또는 업데이트
*/
private function insertOrUpdateVrfcReq(array $vrfcReqParam): int
{
$articleNumber = $vrfcReqParam['atcl_no'];
$existing = $this->vrfcReqModel->where('atcl_no', $articleNumber)->first();
if ($existing) {
// 업데이트
$vrSq = $existing['vr_sq'] ?? $existing['id'];
CLI::write(CLI::color("🟡 기존 데이터 발견 (atcl_no: $articleNumber) -> 업데이트", 'yellow'));
if (!$this->vrfcReqModel->update($vrSq, $vrfcReqParam)) {
$this->logAndThrowError($vrfcReqParam, "VrfcReq Update 실패 :: $articleNumber");
}
CLI::write(CLI::color("✅ Update 성공 (vr_sq: $vrSq)", 'blue'));
return $vrSq;
} else {
// 신규 등록
if (!$this->vrfcReqModel->insert($vrfcReqParam)) {
$this->logAndThrowError($vrfcReqParam, "VrfcReq Insert 실패 :: $articleNumber");
}
$vrSq = $this->vrfcReqModel->getInsertID();
CLI::write(CLI::color("✅ Insert 성공 (vr_sq: $vrSq, atcl_no: $articleNumber)", 'blue'));
return $vrSq;
}
}
/**
* 에러 로깅 및 예외 발생
*/
private function logAndThrowError(array $data, string $message): void
{
$dbError = $this->db->error();
CLI::write(CLI::color('❌ SQL ERROR', 'red', 'bold'));
CLI::write(CLI::color('메시지: ', 'white') . $dbError['message']);
CLI::write(CLI::color('쿼리: ', 'white') . (string)$this->vrfcReqModel->getLastQuery());
throw new Exception($message . ": " . $dbError['message']);
}
/**
* URL 이미지를 v2_url_img_save 테이블에 저장
*
* @param array $fileExtracted extractFilesByType로 추출된 파일 배열
* @param string $atclNo 기사번호
* @param int $vrSq 검증요청ID
*/
private function saveUrlImagesToDb(array $fileExtracted, string $atclNo, int $vrSq): void
{
$fileTypes = [
'certRegister' => '2', // 등기부등본
'confirmDocImgUrl' => '2', // 확인서이미지
'referenceFileUrl' => '1' // 홍보자료
];
$saveCount = 0;
foreach ($fileTypes as $key => $type) {
if (!empty($fileExtracted[$key]) && is_array($fileExtracted[$key])) {
foreach ($fileExtracted[$key] as $url) {
if (!empty($url)) {
$insertData = [
'url' => $url,
'type' => $type,
'atcl_no' => $atclNo,
'vr_sq' => $vrSq,
'status' => 'save',
'try_cnt' => 0
];
if ($this->urlImgSaveModel->insert($insertData)) {
$saveCount++;
} else {
CLI::write(CLI::color("⚠️ URL 저장 실패: $url", 'yellow'));
}
}
}
}
}
if ($saveCount > 0) {
CLI::write(CLI::color("✅ URL 이미지 저장 완료: $saveCount개", 'blue'));
write_custom_log("URL 이미지 저장 | Atcl: $atclNo | VR_SQ: $vrSq | Count: $saveCount", 'INFO', 'service');
}
}
}

View File

@@ -4,620 +4,80 @@ namespace App\Services;
use CodeIgniter\CLI\CLI;
use App\Libraries\NaverApiClient;
use App\Models\Entities\VrfcReqModel;
use App\Models\Entities\V2articleinfoModel;
use App\Models\Entities\V2articleinfoetcModel;
use App\Models\Entities\V2stdailyModel;
use App\Models\Entities\NaverRawStagingModel;
use App\Models\Entities\ReceiptModel;
use App\Models\Entities\ResultModel;
use App\Services\StatusService; // 추가
use App\Services\Handlers\TypeSHandler;
use App\Services\Handlers\TypeV2Handler;
use Exception;
/**
* 네이버 부동산 매물 처리 서비스
*
* 네이버 API 응답을 받아서 타입별 처리 로직으로 위임하는 오케스트레이터 역할
* - Type S: 현장확인 (A01)
* - Type V2: 일반/서류/비공동 (D04, F01 등)
*/
class NaverService
{
protected $db;
protected $naverClient;
protected $VrfcReqModel;
protected $V2stdailyModel;
protected $statusService;
protected $rawStagingModel;
protected $receiptModel;
protected $resultModel;
protected $articleModel;
protected $articleEtcModel;
private $db;
private $naverClient;
private $rawStagingModel;
private $typeSHandler;
private $typeV2Handler;
public function __construct()
{
$this->db = \Config\Database::connect();
helper('log');
$this->naverClient = new NaverApiClient();
$this->rawStagingModel = new NaverRawStagingModel();
$this->typeSHandler = new TypeSHandler();
$this->typeV2Handler = new TypeV2Handler();
helper('log');
}
/**
* 모델/서비스 지연 로딩 (Null 에러 방지 핵심)
* 메인 프로세스: 네이버 API 호출 및 타입별 처리
*
* @param array $payload 요청 페이로드 (articleNumber, requestType 등)
* @return int 처리된 ID (rcpt_sq 또는 vr_sq)
* @throws Exception
*/
private function getStatusService() {
return $this->statusService ??= new StatusService();
}
private function getModel($property, $class) {
return $this->$property ??= new $class();
}
/**
* NaverApiClient 지연 로딩
*/
private function getNaverClient()
{
if ($this->naverClient === null) {
$this->naverClient = new \App\Libraries\NaverApiClient();
}
return $this->naverClient;
}
/**
* 메인 프로세스: 요청 타입에 따른 분기 처리
*/
public function processArticle(array $payload)
public function processArticle(array $payload): int
{
$articleNumber = $payload['articleNumber'];
$requestType = $payload['requestType'] ?? '';
CLI::write(CLI::color('🟢 getArticleInfo Start :: ' . $articleNumber , 'green'));
// 1. 네이버 API 호출
$response = $this->getNaverClient()->getArticleInfo($articleNumber);
if (!$response || $response['code'] !== 'success') {
throw new \Exception("네이버 API 응답 에러: $articleNumber");
}
$rawData = $response['data'];
$vType = $rawData['verificationTypeCode'] ?? '';
// [Staging] 원본 저장
$this->getModel('rawStagingModel', NaverRawStagingModel::class)->insert([
'atcl_no' => $articleNumber,
'verification_type' => $vType,
'request_type' => $requestType,
'raw_json' => $rawData
]);
CLI::write(CLI::color('🟢 임시테이블 :: ' . $this->rawStagingModel->getLastQuery() , 'green'));
// 3. 타입별 분기 처리
if ($vType === 'S') {
// [Type S] 현장확인 응답 처리 (A01 등)
return $this->processTypeS($articleNumber, $rawData, $payload);
} else {
// [Type D/기타] 서류확인/비공동 처리 (D04, F01 등)
return $this->processTypeV2($articleNumber, $rawData, $payload);
}
// $vrfcParams = $this->mapToDatabaseParams($response['data'], $payload);
// write_custom_log("PROCESS_START | Type: $requestType | Atcl: $articleNumber", 'INFO', 'service');
// switch ($requestType) {
// case 'REG': // 신규 등록
// $vr_sq = $this->insertVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], $vrfcParams['vrfc_type'] . '0103', '1', 'add');
// break;
// case 'MOD': // 수정
// $vr_sq = $this->updateVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], $vrfcParams['vrfc_type'] . '0102', '1', 'add');
// break;
// case 'CNC': // 취소
// $vr_sq = $this->deleteVrfcReq($articleNumber, $vrfcParams);
// if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], 'A0101', '1', 'add');
// break;
// // case 'FIN': // 완료
// // $vr_sq = $this->finVrfcReq($articleNumber, $vrfcParams);
// // if ($vr_sq) $this->V2stdailyModel->set_v2_st_daily(null, $vrfcParams['cpid'], 'A0101', '1', 'add');
// // break;
// default:
// throw new \Exception("알 수 없는 requestType: $requestType");
// }
// return ['vr_sq' => $vr_sq, 'articleNumber' => $articleNumber];
}
/**
* [Type S] 현장확인 응답 처리 (A01 등)
*/
private function processTypeS($articleNumber, $rawData, $payload)
{
$now = db_now();
CLI::write(CLI::color('🟢 getArticleInfo Start :: ' . $articleNumber, 'green'));
// 시작 전 트랜잭션
$this->db->transStart();
try {
// 1. 네이버 API 호출
$response = $this->naverClient->getArticleInfo($articleNumber);
if (!$response || $response['code'] !== 'success') {
throw new Exception("네이버 API 응답 에러: $articleNumber");
}
switch ( trim($rawData['tradeType']) ) {
case '매매': $trade_type = 'A1'; break;
case '전세': $trade_type = 'B1'; break;
case '월세': $trade_type = 'B2'; break;
case '단기임대': $trade_type = 'B3'; break;
}
/* 좌표와 전용면적을 기준으로 */
if( in_array($rawData['realEstateTypeCode'], array('C01', 'C02'))){
$ground_plan = 'N';
$rawData = $response['data'];
$vType = $rawData['verificationTypeCode'] ?? '';
// 2. 원본 데이터 Staging 저장
$this->rawStagingModel->insert([
'atcl_no' => $articleNumber,
'verification_type' => $vType,
'request_type' => $requestType,
'raw_json' => $rawData
]);
CLI::write(CLI::color('🟢 임시테이블 저장 완료', 'green'));
// 3. 타입별 분기 처리
if ($vType === 'S') {
return $this->typeSHandler->handle($articleNumber, $rawData, $payload);
} else {
$ground_plan = 'Y';
}
try {
// 1. receipt 데이터 준비
$receiptData = [
'comp_sq' => '2',
'rcpt_rating' => '3',
'rcpt_key' => $articleNumber,
'rcpt_atclno' => $articleNumber,
'rcpt_product' => $rawData['realEstateTypeCode'] ?? null,
'rcpt_product_nm' => $rawData['realEstateType'] ?? null,
'rcpt_product_info1'=> $rawData['tradeType'] ?? null,
'rcpt_product_info2'=> $rawData['price']['dealAmount'] ?? '0',
'rcpt_product_info4'=> $rawData['price']['preSaleAmount'] ?? '0',
'rcpt_product_info5'=> $rawData['price']['premiumAmount'] ?? '0',
'rcpt_living_yn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
'rcpt_agent' => $rawData['realtor']['realtorName'] ?? null,
'rcpt_sido' => mb_substr($rawData['address']['legalDivision']['cityNumber'] ?? '', 0, 5),
'rcpt_gugun' => mb_substr($rawData['address']['legalDivision']['divisionNumber'] ?? '', 0, 10),
'rcpt_dong' => $rawData['address']['legalDivision']['sectorNumber'] ?? null,
'rcpt_hscp_nm' => $rawData['address']['complexName'] ?? null,
'rcpt_hscp_no' => $rawData['address']['complexNumber'] ?? null,
'rcpt_ptp_nm' => null,
'rcpt_ptp_no' => $rawData['address']['pyeongTypeNumber'] ?? null,
'rcpt_dtl_addr' => trim(($rawData['address']['legalDivision']['legalDivisionAddress'] ?? '') . $rawData['address']['buildingName'] . '동 ' . ($rawData['address']['hoName'] ?? '') . '호'),
'rcpt_etc_addr' => $rawData['address']['hoName'] ?? null,
'rcpt_floor' => $rawData['floor']['correspondenceFloorCount'] ?? null,
'rcpt_floor2' => $rawData['floor']['totalFloorCount'] ?? null,
'rcpt_exps_type' => '',
'rcpt_exp_photo_yn' => 'Y',
'rcpt_deal_type' => $rawData['tradeTypeCode'] ?? null,
'rcpt_product_nm' => $rawData['tradeType'] ?? null,
'trade_type' => $trade_type ?? null,
'ground_plan' => $ground_plan,
'excls_spce' => $rawData['space']['exclusiveSpace'] ?? null,
'sply_spc' => $rawData['space']['supplySpace'] ?? null,
'tot_spc' => $rawData['space']['totalSpace'] ?? null,
'grnd_spc' => $rawData['space']['groundSpace'] ?? null,
'bldg_spc' => $rawData['space']['buildingSpace'] ?? null,
'share_spc' => $rawData['space']['supplySpace']-$rawData['space']['exclusiveSpace'] ?? null,
'room_cnt' => $rawData['facilities']['roomCount'] ?? null,
'cupnNo' => $rawData['couponNumber'] ?? null,
'roomSiteAtclRgstCnt' => $rawData['site']['monthlyRegisterCount'] ?? null,
'roomSiteAtclExpsCnt' => $rawData['site']['monthlyExposureCount'] ?? null,
'direct_trad_yn' => ($rawData['seller']['isDirectTrade'] ?? false) ? 'Y' : 'N',
'sellr_nm' => $rawData['seller']['sellerName'] ?? null,
'sellr_tel_no' => $rawData['seller']['sellerTelephoneNumber'] ?? null,
'rcpt_ref_addr' => $rawData['address']['etcAddress'] ?? null,
'rcpt_tm' => $now,
'rcpt_stat' => '100000',
'rcpt_x' => $rawData['address']['longitude'] ?? null,
'rcpt_y' => $rawData['address']['latitude'] ?? null,
'agent_id' => '',
'agent_nm' => $rawData['realtor']['realtorName'] ?? null,
'agent_head_tel' => $rawData['realtor']['representativeCellphoneNumber'] ?? null,
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00', // 컬럼명이 rsrv_tm_ap 인지 확인 필요 (제공해주신 스키마 기준)
'insert_tm' => $now,
'rcpt_cpid' => $rawData['cpId'] ?? 'naver',
'room_cnt' => $rawData['facilities']['roomCount'] ?? null,
'isSiteVRVerification' => ($rawData['site']['isVrVerification'] ?? false) ? 'Y' : 'N',
'isPromotionApply' => ($rawData['site']['isVrRepresentativeApply'] ?? false) ? 'Y' : 'N',
];
if (!$this->receiptModel->insert($receiptData)) {
throw new \Exception("Receipt Insert 실패: " . json_encode($this->receiptModel->errors()));
return $this->typeV2Handler->handle($articleNumber, $rawData, $payload);
}
$rcpt_sq = $this->receiptModel->getInsertID();
if ( $receiptData['isVrVerification'] == "Y") {
$dept_sq = '29';
$usr_sq = '1993';
}
// 2. result 데이터 준비
$resultData = [
'rcpt_sq' => $rcpt_sq,
'use_yn' => 'Y',
'cust_nm' => '',
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00', // 컬럼명이 rsrv_tm_ap 인지 확인 필요 (제공해주신 스키마 기준)
'result_cd1' => '10',
'result_cd2' => '1000',
'result_cd3' => '100000',
'insert_tm' => $now,
'insert_usr' => 0,
'update_tm' => $now,
'update_usr' => 0,
'dept_sq' => $dept_sq, // 필요 시 매핑 로직 추가
'usr_sq' => $usr_sq, // 필요 시 매핑 로직 추가
'resYn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
];
if (!$this->resultModel->insert($resultData)) {
throw new \Exception("Result Insert 실패");
}
$this->db->transComplete();
// 성공 로그 생성 쿼리 포함
write_custom_log("Type S 처리 성공 | Atcl: $articleNumber | Rcpt_sq: $rcpt_sq", 'INFO', 'service');
write_custom_log("Receipt Insert SQL: " . (string)$this->receiptModel->getLastQuery(), 'INFO', 'service');
write_custom_log("Result Insert SQL: " . (string)$this->resultModel->getLastQuery(), 'INFO', 'service');
// 예약 정보 동기화 전송
$return = $this->naverClient->submitSyncResult($rawData['reserveNo']);
write_custom_log("Naver Sync Result Response: " . json_encode($return), 'INFO', 'service');
// transComplete 이후에 transStatus를 확인하는 것이 CI4의 표준입니다.
if ($this->db->transStatus() === false) {
// transComplete가 실패하면 자동으로 롤백되지만, 명시적 예외 처리가 안전합니다.
// 로그 남기기
write_custom_log("Type S DB 트랜잭션 최종 실패", 'ERROR', 'service');
throw new \Exception("Type S DB 트랜잭션 최종 실패");
}
return $rcpt_sq;
} catch (\Exception $e) {
// 이미 transComplete 내부에서 실패 시 롤백되지만, 예외 발생 시 수동 롤백 보장
// if ($this->db->transEnabled()) {
$this->db->transRollback();
// }
} catch (Exception $e) {
write_custom_log("processArticle 실패: " . $e->getMessage(), 'ERROR', 'service');
throw $e;
}
}
/**
* [Type V2] 일반/서류/비공동주택 처리 로직
*/
private function processTypeV2($articleNumber, $rawData, $payload)
{
CLI::write(CLI::color('🟢 V2_VRFC_REQ :: START ' , 'green'));
$vrfcParam = $this->v2Parameter($articleNumber, $rawData, $payload);
$articleInfoParam = $this->articleInfoParameter($articleNumber, $rawData, $payload);
$articleInfoEtcParam = $this->articleInfoEtcParameter($articleNumber, $rawData, $payload);
try {
switch ($payload['requestType']){
case "REG":
$vr_sq = $this->insertVrfcReq($vrfcParam);
$articleInfoParam['vr_sq'] = $vr_sq;
write_custom_log("articleInfoParam :: " . json_encode($articleInfoParam, JSON_UNESCAPED_UNICODE) , "INFO", "SERVICE");
if (!$this->getModel('articleModel', V2articleinfoModel::class)->insert($articleInfoParam)) {
throw new \Exception("ArticleInfo Insert 실패: " . json_encode($this->db->error()));
}
$articleInfoEtcParam['vr_sq'] = $vr_sq;
if (!$this->getModel('articleEtcModel', V2articleinfoetcModel::class)->insert($articleInfoEtcParam)) {
throw new \Exception("ArticleInfoEtc Insert 실패");
}
break;
case "MOD":
break;
case "CNC":
break;
}
} catch (\Exception $e) {
write_custom_log("CRITICAL_ERROR :: " . $e->getMessage(), "ERROR", "SERVICE");
throw $e;
}
}
/**
* [REG] 신규 등록
*/
private function insertVrfcReq($vrfcParam)
{
CLI::write(CLI::color('🟢 매물 정보 시작', 'green'));
$model = $this->getModel('VrfcReqModel', VrfcReqModel::class);
$existing = $model->where('atcl_no', $vrfcParam['atcl_no'])->first();
if ($existing) throw new \Exception("중복 등록 시도: " . $vrfcParam['atcl_no']);
if (!$model->insert($vrfcParam)) {
$dbError = $this->db->error();
$lastQuery = (string)$model->getLastQuery();
// 🚨 에러 발생 시 상세 정보 출력
CLI::write(CLI::color('❌ SQL INSERT ERROR', 'red', 'bold'));
CLI::write(CLI::color('메시지: ', 'white') . $dbError['message']);
CLI::write(CLI::color('쿼리 실행: ', 'white') . (string)$model->getLastQuery());
// 입력하려던 데이터 덤프 (디버깅용)
CLI::write(CLI::color('입력 데이터:', 'yellow'));
print_r($vrfcParam);
throw new \Exception("신규 등록 실패: " . $dbError['message']);
}
$vr_sq = $model->getInsertID();
CLI::write(CLI::color("✅ Insert 성공 (vr_sq: $vr_sq)", 'blue'));
// 🟢 여기서 Null 에러 방지 (getStatusService 사용)
$this->getStatusService()->recordStatusAndHistory($vr_sq, '10', 'C9', "NEW 신규접수 : 10");
return $vr_sq;
}
private function v2Parameter($articleNumber, $rawData , $payload){
$now = db_now();
$step = isset($rawData['step']) ? $rawData['step'] : '00';
$rdate = $payload['requestDate'] ?? db_now('YmdHis');
$insert_user = 0;
$stat_cd = '10';
$sync_yn = 'N';
$insert_tm = $now;
$reg_type = function($payload) {
switch ($payload['requestType'] ?? '') {
case 'REG': return 'C';
case 'MOD': return 'U';
case 'CNC': return 'D';
default: return '0';
}
};($payload);
$files = $rawData['files'] ?? [];
$certRegister = [];
$confirm_doc_img_url = [];
$referenceFileUrl = [];
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'];
if ($fileTypeCode == 'RCDOC') {
$certRegister[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'ADDOC') {
$confirm_doc_img_url[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'REFER') {
$referenceFileUrl[] = $file['originalFileUrl'];
}
}
// 1. v2_vrfc_req (검증요청) 데이터 준비
$vrfcReqData = [
'reqSeq' => '', // 네이버 요청 고유 ID
'atcl_no' => $articleNumber,
'step' => $step, // 기본 단계 설정
'cpid' => $rawData['cpId'] ?? 'naver',
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? '',
'trade_type' => $rawData['tradeTypeCode'] ?? '',
'realtor_nm' => $rawData['realtor']['realtorName'] ?? null,
'realtor_tel_no' => $rawData['realtor']['representativeCellphoneNumber'] ?? null,
'seller_tel_no' => $rawData['seller']['cellphoneNumber'] ?? null,
'vrfc_type' => $rawData['verificationTypeCode'] ?? 'D', // D, T, P 등
'rgbk_confirm' => null,
'req_type' => $reg_type($payload), // 등록:C, 수정:U, 취소:D
'rdate' => $rdate,
'cpTelNo' => null,
'stat_cd' => $stat_cd, // 초기 대기 상태
'insert_user' => $insert_user,
'insert_tm' => $insert_tm,
'sync_yn' => $sync_yn,
'rgbk_confirm_owner_nm' => null,
'direct_trad_yn' => ($rawData['seller']['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode($confirm_doc_img_url),
'confirm_doc_owner_check_yn' => null,
'certRegister' => json_encode($certRegister),
'referenceFileUrl' => json_encode($referenceFileUrl),
];
return $vrfcReqData;
}
private function articleInfoParameter($articleNumber, $rawData , $payload){
// JSON 객체 안전하게 로드
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
$files = $rawData['realtor']['file'] ?? [];
$certRegister = [];
$confirm_doc_img_url = [];
$referenceFileUrl = [];
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'];
if ($fileTypeCode == 'RCDOC') {
$certRegister[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'ADDOC') {
$confirm_doc_img_url[] = $file['originalFileUrl'];
} elseif ($fileTypeCode == 'REFER') {
$referenceFileUrl[] = $file['originalFileUrl'];
}
}
$ownerTypeCodeRaw = $rawData['ownerTypeCode'] ?? null;
$ownerTypeCode = match($ownerTypeCodeRaw) {
"INDIV" => 0,
"CORP" => 1,
"FRGNR" => 2,
"DELEG" => 3,
default => null,
};
$ownerCheckYn = ($seller['isOwnerCertificationAgree'] ?? false) ? 'Y' : 'N';
return [
// 'vr_sq' => $vr_sq,
'atcl_no' => $articleNumber,
'cpid' => $rawData['cpId'] ?? null,
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? null,
'rlet_type_cd' => $rawData['realEstateTypeCode'] ?? null,
'trade_type' => $rawData['tradeTypeCode'] ?? null,
'address_code' => $address['legalDivision']['sectorNumber'] ?? null,
'address1' => $address['complexName'] ?? null,
'address2' => trim(($address['buildingName'] ?? '') . ' ' . ($address['hoName'] ?? '')),
'address3' => $address['legalDivision']['legalDivisionAddress'] ?? null,
// 면적 및 가격 (데이터 없으면 null)
'sply_spc' => $space['supplySpace'] ?? null,
'excls_spc' => $space['exclusiveSpace'] ?? null,
'tot_spc' => $space['totalSpace'] ?? null,
'grnd_spc' => $space['groundSpace'] ?? null,
'bldg_spc' => $space['buildingSpace'] ?? null,
'deal_amt' => $price['dealAmount'] ?? 0,
'wrrnt_amt' => $price['warrantyAmount'] ?? 0,
'lease_amt' => $price['leaseAmount'] ?? 0,
'isale_amt' => $price['preSaleAmount'] ?? 0,
'prem_amt' => $price['premiumAmount'] ?? 0,
'sise' => null,
// 층 및 일정
'floor' => $floor['correspondenceFloorCount'] ?? null,
'floor2' => $floor['totalFloorCount'] ?? null,
'rdate' => date("Y-m-d H:i:s" , strtotime( $payload['requestDatetime'] )),
// 셀러
'seller_tel_no' => $seller['sellerTelephoneNumber'] ?? null, // JSON seller 객체에 연락처 필드 부재
'seller_nm' => $seller['sellerName'] ?? null,
// 중개업소
'realtor_nm' => $realtor['realtorName'] ?? null,
'realtor_tel_no' => $realtor['representativeTelephoneNumber'] ?? null,
// 단지 정보
'hscp_no' => $address['complexNumber'] ?? null,
'hscp_nm' => $address['complexName'] ?? null,
'ptp_no' => $address['pyeongTypeNumber'] ?? null,
'ptp_nm' => $address['pyeongTypeNumber'] ?? null,
// 담당자
'charger' => null, // 담당자
'reg_price_yn' => 'N', // 가격수정요청여부
'reg_charger' => null, // 등기부등본 담당자
'dept1_sq' => null, // 부서(본부)
'dept2_sq' => null, // 부서(팀)
'reg_dept2_sq' => null, // 부서(팀)
'reg_dept1_sq' => null, // 부서(본부)
// 상태 및 기타
'dong_ho_chk' => ($address['isDongHoCheck'] ?? false) ? 'Y' : 'N',
'hscplqry_lv' => $address['inquiryLevel'] ?? null,
// 소유자
'ownerNm' => $seller['ownerName'] ?? null,
'ownerTelNo' => $seller['ownerName'] ?? null,
//
'chg_trade_type' => null,
'chg_address2' => null,
'chg_address3' => null,
'chg_seller_tel' => null,
'chg_amt' => null,
'reg_status' => null,
'cupnNo' => null,
'roomSiteAtclRgstCnt' => null,
'rootSiteAtclExpsCnt' => null,
'redvlp_area_nm' => $address['redevelopAreaName'] ?? null,
'biz_stp_desc' => $address['bizStepDescription'] ?? null,
// file
'cert_register' => json_encode($certRegister, JSON_UNESCAPED_UNICODE),
'direct_trad_yn' => ($seller['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode( $confirm_doc_img_url , JSON_UNESCAPED_UNICODE),
'confirm_doc_owner_check_yn' => $ownerCheckYn,
'owner_birth' => null,
'vrfc_type_sub' => ($rawData['verificationTypeCode'] === 'D') ? ($ownerCheckYn === 'Y' ? 'D2' : 'D1') : ($rawData['verificationTypeCode'] === 'N' ? 'N2' : $rawData['verificationTypeCode'] . '1'),
'cert_register_save_yn' => 'N',
'confirm_doc_img_url_save_yn' => 'N',
'address4' => $address['etcAddress'] ?? null,
'reference_file_url' => !empty($referenceFileUrl) ? implode('|', $referenceFileUrl) : '',
'reference_file_url_save_yn' => !empty($referenceFileUrl) ? 'Y' : 'N',
'registerBookUniqueNo' => $rawData['verificationReference'] ?? null,
'relationSellerAndOwner' => null,
'ownerTypeCode' => $ownerTypeCode,
'registerBookUniqueNumber' => null
];
}
private function articleInfoEtcParameter($articleNumber, $rawData , $payload){
// JSON 객체 안전하게 로드
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
$files = $rawData['realtor']['file'] ?? [];
// 공동 : 동 정보, 비공동 : 지번주소
if ( $rawData['realEstateTypeCode'] == "A01"){
$address2b = $address['buildingName'];
} else {
$address2b = $address['jibunAddress'] ?? null;
}
$ownerTypeCode = null;
$ownerTypeCodeResponse = isset($rawData['ownerTypeCode']) ?? null;
if ($ownerTypeCodeResponse !== null ){
switch ($ownerTypeCodeResponse) {
case "INDIV":
$ownerTypeCode = 0;
break;
case "CORP":
$ownerTypeCode = 1;
break;
case "FRGNR":
$ownerTypeCode = 2;
break;
case "DELEG":
$ownerTypeCode = 3;
break;
}
}
return [
'atcl_no' => $articleNumber,
'vir_addr_yn' => ($address['isVirtualAddress'] ?? null) === true ? 'Y' : (($address['isVirtualAddress'] ?? null) === false ? 'N' : null),
'bild_no' => null,
'vrfcMthdTpcd' => null,
'cert_uncnfrm_status' => null,
'expsStartYmdt' => $rawData['exposureStartDateTime'] ?? null,
'vrfcAutoPassYn' => ($rawData['isAutoVerificationRequested'] ?? false) === true ? "Y" : "N",
'address2a' => $address['liAddress'] ?? null,
'address2b' => $address2b,
'registerBookUniqueNo' => null,
'ownerTypeCode' => $ownerTypeCode,
'orgRepCphNo' => null,
'orgRepTelNo' => null,
'orgRltrNm' => null,
'orgRepNm' => null,
'smsSendTime' => null,
'document_cert_method' => null,
'noRgbkVrfcReqYn' => ($address['isUnregisteredVerificationRequested'] ?? null) === true ? 'Y' : (($address['isUnregisteredVerificationRequested'] ?? null) === false ? 'N' : null),
'areaByBdbkVrfcReqYn' => ($address['isBuildingRegisterAreaCheckRequested'] ?? null) === true ? 'Y' : (($address['isBuildingRegisterAreaCheckRequested'] ?? null) === false ? 'N' : null),
'orgAtclNo' => null,
'atclStatCd' => null,
'repNm' => $realtor['realtorName'] ?? null,
'cpName' => $rawData['cpId'],
'document_not_received' => null,
'final_failure' => null,
];
}
}

View File

@@ -0,0 +1,139 @@
<?php
namespace App\Services\ParameterMapper;
/**
* 파라미터 매퍼 기본 추상 클래스
* 네이버 API 응답을 데이터베이스 파라미터로 변환하는 로직을 정의
*/
abstract class BaseParameterMapper
{
protected $db;
public function __construct()
{
$this->db = \Config\Database::connect();
helper('log');
}
/**
* 추상 메서드: 매핑 로직 구현
*/
abstract public function map(string $articleNumber, array $rawData, array $payload): array;
/**
* 소유자 타입 코드 변환
*/
protected function mapOwnerTypeCode(?string $ownerTypeCodeRaw): ?int
{
return match($ownerTypeCodeRaw) {
"INDIV" => 0,
"CORP" => 1,
"FRGNR" => 2,
"DELEG" => 3,
default => null,
};
}
/**
* 거래 유형 변환
*/
protected function mapTradeType(?string $tradeType): ?string
{
return match(trim($tradeType ?? '')) {
'매매' => 'A1',
'전세' => 'B1',
'월세' => 'B2',
'단기임대' => 'B3',
default => null,
};
}
/**
* 파일 배열 추출 (save_yn 플래그 포함)
*/
public function extractFilesByType(array $files): array
{
$certRegister = [];
$confirmDocImgUrl = [];
$referenceFileUrl = [];
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'] ?? '';
$fileUrl = $file['originalFileUrl'] ?? '';
switch ($fileTypeCode) {
case 'RCDOC':
$certRegister[] = $fileUrl;
break;
case 'ADDOC':
$confirmDocImgUrl[] = $fileUrl;
break;
case 'REFER':
$referenceFileUrl[] = $fileUrl;
break;
}
}
return [
'certRegister' => $certRegister,
'confirmDocImgUrl' => $confirmDocImgUrl,
'referenceFileUrl' => $referenceFileUrl,
'cert_register_save_yn' => !empty($certRegister) ? 'Y' : 'N',
'confirm_doc_img_url_save_yn' => !empty($confirmDocImgUrl) ? 'Y' : 'N',
'reference_file_url_save_yn' => !empty($referenceFileUrl) ? 'Y' : 'N',
];
}
/**
* 파일 URL을 v2_url_img_save 테이블에 저장
* @param array $files 파일 배열
* @param string $atclNo 매물번호
* @param int $vrSq 검증요청순번
*/
protected function saveUrlImagesToDb(array $files, string $atclNo, int $vrSq): bool
{
if (empty($files)) {
return true;
}
$urlImgModel = new \App\Models\Entities\V2urlimgsaveModel();
foreach ($files as $file) {
$fileTypeCode = $file['fileTypeCode'] ?? '';
$fileUrl = $file['originalFileUrl'] ?? '';
if (empty($fileUrl)) {
continue;
}
// type 매핑: RCDOC, ADDOC = 2(등기), REFER = 1(홍보)
$type = in_array($fileTypeCode, ['RCDOC', 'ADDOC']) ? '2' : '1';
$data = [
'url' => $fileUrl,
'type' => $type,
'atcl_no' => $atclNo,
'vr_sq' => $vrSq,
'status' => 'save',
'try_cnt' => 0,
'server_nm' => gethostname(),
];
if (!$urlImgModel->insert($data)) {
write_custom_log("URL 이미지 저장 실패: " . json_encode($data), 'ERROR', 'service');
return false;
}
}
return true;
}
/**
* 필수 필드 안전하게 로드
*/
protected function getSafeData(array $data, string $key, $default = null)
{
return $data[$key] ?? $default;
}
}

View File

@@ -0,0 +1,131 @@
<?php
namespace App\Services\ParameterMapper;
/**
* Type S 파라미터 매퍼
* 현장확인 매물 (A01 등) 데이터를 Receipt 테이블용 파라미터로 변환
*/
class TypeSParameterMapper extends BaseParameterMapper
{
/**
* Receipt 테이블용 파라미터 생성
*/
public function mapReceipt(string $articleNumber, array $rawData, array $payload): array
{
$now = db_now();
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
// 평면도 여부 결정
$groundPlan = in_array($rawData['realEstateTypeCode'] ?? '', ['C01', 'C02']) ? 'N' : 'Y';
// 거래 유형 매핑
$tradeType = $this->mapTradeType($rawData['tradeType'] ?? null);
return [
'comp_sq' => '2',
'rcpt_rating' => '3',
'rcpt_key' => $articleNumber,
'rcpt_atclno' => $articleNumber,
'rcpt_product' => $rawData['realEstateTypeCode'] ?? null,
'rcpt_product_nm' => $rawData['realEstateType'] ?? null,
'rcpt_product_info1' => $rawData['tradeType'] ?? null,
'rcpt_product_info2' => $price['dealAmount'] ?? '0',
'rcpt_product_info4' => $price['preSaleAmount'] ?? '0',
'rcpt_product_info5' => $price['premiumAmount'] ?? '0',
'rcpt_living_yn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
'rcpt_agent' => $realtor['realtorName'] ?? null,
'rcpt_sido' => mb_substr($address['legalDivision']['cityNumber'] ?? '', 0, 5),
'rcpt_gugun' => mb_substr($address['legalDivision']['divisionNumber'] ?? '', 0, 10),
'rcpt_dong' => $address['legalDivision']['sectorNumber'] ?? null,
'rcpt_hscp_nm' => $address['complexName'] ?? null,
'rcpt_hscp_no' => $address['complexNumber'] ?? null,
'rcpt_ptp_nm' => null,
'rcpt_ptp_no' => $address['pyeongTypeNumber'] ?? null,
'rcpt_dtl_addr' => trim(
($address['legalDivision']['legalDivisionAddress'] ?? '') .
($address['buildingName'] ?? '') .
'동 ' . ($address['hoName'] ?? '') . '호'
),
'rcpt_etc_addr' => $address['hoName'] ?? null,
'rcpt_floor' => $floor['correspondenceFloorCount'] ?? null,
'rcpt_floor2' => $floor['totalFloorCount'] ?? null,
'rcpt_exps_type' => '',
'rcpt_exp_photo_yn' => 'Y',
'rcpt_deal_type' => $rawData['tradeTypeCode'] ?? null,
'trade_type' => $tradeType,
'ground_plan' => $groundPlan,
'excls_spce' => $space['exclusiveSpace'] ?? null,
'sply_spc' => $space['supplySpace'] ?? null,
'tot_spc' => $space['totalSpace'] ?? null,
'grnd_spc' => $space['groundSpace'] ?? null,
'bldg_spc' => $space['buildingSpace'] ?? null,
'share_spc' => ($space['supplySpace'] ?? 0) - ($space['exclusiveSpace'] ?? 0),
'room_cnt' => $rawData['facilities']['roomCount'] ?? null,
'cupnNo' => $rawData['couponNumber'] ?? null,
'roomSiteAtclRgstCnt' => $rawData['site']['monthlyRegisterCount'] ?? null,
'roomSiteAtclExpsCnt' => $rawData['site']['monthlyExposureCount'] ?? null,
'direct_trad_yn' => ($seller['isDirectTrade'] ?? false) ? 'Y' : 'N',
'sellr_nm' => $seller['sellerName'] ?? null,
'sellr_tel_no' => $seller['sellerTelephoneNumber'] ?? null,
'rcpt_ref_addr' => $address['etcAddress'] ?? null,
'rcpt_tm' => $now,
'rcpt_stat' => '100000',
'rcpt_x' => $address['longitude'] ?? null,
'rcpt_y' => $address['latitude'] ?? null,
'agent_id' => '',
'agent_nm' => $realtor['realtorName'] ?? null,
'agent_head_tel' => $realtor['representativeCellphoneNumber'] ?? null,
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00',
'insert_tm' => $now,
'rcpt_cpid' => $rawData['cpId'] ?? 'naver',
'isSiteVRVerification' => ($rawData['site']['isVrVerification'] ?? false) ? 'Y' : 'N',
'isPromotionApply' => ($rawData['site']['isVrRepresentativeApply'] ?? false) ? 'Y' : 'N',
];
}
/**
* Result 테이블용 파라미터 생성
*/
public function mapResult(int $rcptSq, array $rawData): array
{
$now = db_now();
// VR 검증 여부에 따른 담당자 설정
$deptSq = ($rawData['site']['isVrVerification'] ?? false) ? '29' : null;
$usrSq = ($rawData['site']['isVrVerification'] ?? false) ? '1993' : null;
return [
'rcpt_sq' => $rcptSq,
'use_yn' => 'Y',
'cust_nm' => '',
'rsrv_date' => $rawData['site']['visitReserveDate'] ?? null,
'rsrv_tm_ap' => '00',
'result_cd1' => '10',
'result_cd2' => '1000',
'result_cd3' => '100000',
'insert_tm' => $now,
'insert_usr' => 0,
'update_tm' => $now,
'update_usr' => 0,
'dept_sq' => $deptSq,
'usr_sq' => $usrSq,
'resYn' => ($rawData['site']['isRegistration'] ?? false) ? 'Y' : 'N',
];
}
/**
* 인터페이스 구현: 기본 map 메서드
* (실제로는 mapReceipt와 mapResult를 분리하여 사용)
*/
public function map(string $articleNumber, array $rawData, array $payload): array
{
return $this->mapReceipt($articleNumber, $rawData, $payload);
}
}

View File

@@ -0,0 +1,276 @@
<?php
namespace App\Services\ParameterMapper;
/**
* Type V2 파라미터 매퍼
* 일반/서류/비공동 매물 데이터를 V2 테이블용 파라미터로 변환
*/
class TypeV2ParameterMapper extends BaseParameterMapper
{
/**
* V2 검증 요청 파라미터 생성
*/
public function mapVrfcReq(string $articleNumber, array $rawData, array $payload): array
{
$now = db_now();
$step = $rawData['step'] ?? '00';
$rdate = date("YmdHis", strtotime($payload['requestDate'] ?? db_now('YmdHis')));
$files = $rawData['files'] ?? [];
$fileExtracted = $this->extractFilesByType($files);
$reqType = $this->mapRequestType($payload['requestType'] ?? '');
return [
'reqSeq' => '',
'atcl_no' => $articleNumber,
'step' => $step,
'cpid' => $rawData['cpId'] ?? 'naver',
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? '',
'trade_type' => $rawData['tradeTypeCode'] ?? '',
'realtor_nm' => $rawData['realtor']['realtorName'] ?? null,
'realtor_tel_no' => $rawData['realtor']['representativeCellphoneNumber'] ?? null,
'seller_tel_no' => $rawData['seller']['cellphoneNumber'] ?? null,
'vrfc_type' => $rawData['verificationTypeCode'] ?? 'D',
'rgbk_confirm' => ($rawData['isNeedRegisterBookConfirm'] ?? false) ? 'Y' : 'N',
'req_type' => $reqType,
'rdate' => $rdate,
'cpTelNo' => null,
'stat_cd' => '10',
'insert_user' => 0,
'insert_tm' => $now,
'sync_yn' => 'N',
'rgbk_confirm_owner_nm' => null,
'direct_trad_yn' => ($rawData['seller']['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode($fileExtracted['confirmDocImgUrl']),
'confirm_doc_owner_check_yn' => ($rawData['seller']['isOwnerCertificationAgree'] ?? false) ? 'Y' : 'N',
'certRegister' => json_encode($fileExtracted['certRegister']),
'referenceFileUrl' => json_encode($fileExtracted['referenceFileUrl']),
];
}
/**
* 기사 정보 파라미터 생성
*/
public function mapArticleInfo(string $articleNumber, array $rawData, array $payload): array
{
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
$seller = $rawData['seller'] ?? [];
$realtor = $rawData['realtor'] ?? [];
$files = $rawData['files'] ?? [];
$fileExtracted = $this->extractFilesByType($files);
$ownerTypeCode = $this->mapOwnerTypeCode($rawData['ownerTypeCode'] ?? null);
$ownerCheckYn = ($seller['isOwnerCertificationAgree'] ?? false) ? 'Y' : 'N';
$vrfcTypeSub = $this->mapVrfcTypeSub($rawData['verificationTypeCode'] ?? '', $ownerCheckYn);
return [
'atcl_no' => $articleNumber,
'cpid' => $rawData['cpId'] ?? null,
'cp_atcl_id' => $rawData['cpArticleNumber'] ?? null,
'rlet_type_cd' => $rawData['realEstateTypeCode'] ?? null,
'trade_type' => $rawData['tradeTypeCode'] ?? null,
'address_code' => $address['legalDivision']['sectorNumber'] ?? null,
'address1' => $address['complexName'] ?? null,
'address2' => trim(($address['buildingName'] ?? '') . ' ' . ($address['hoName'] ?? '')),
'address3' => $address['legalDivision']['legalDivisionAddress'] ?? null,
'sply_spc' => $space['supplySpace'] ?? null,
'excls_spc' => $space['exclusiveSpace'] ?? null,
'tot_spc' => $space['totalSpace'] ?? null,
'grnd_spc' => $space['groundSpace'] ?? null,
'bldg_spc' => $space['buildingSpace'] ?? null,
'deal_amt' => $price['dealAmount'] ?? 0,
'wrrnt_amt' => $price['warrantyAmount'] ?? 0,
'lease_amt' => $price['leaseAmount'] ?? 0,
'isale_amt' => $price['preSaleAmount'] ?? 0,
'prem_amt' => $price['premiumAmount'] ?? 0,
'sise' => null,
'floor' => $floor['correspondenceFloorCount'] ?? null,
'floor2' => $floor['totalFloorCount'] ?? null,
'rdate' => date("Y-m-d H:i:s", strtotime($payload['requestDatetime'] ?? 'now')),
'seller_tel_no' => $seller['sellerTelephoneNumber'] ?? null,
'seller_nm' => $seller['sellerName'] ?? null,
'realtor_nm' => $realtor['realtorName'] ?? null,
'realtor_tel_no' => $realtor['representativeTelephoneNumber'] ?? null,
'hscp_no' => $address['complexNumber'] ?? null,
'hscp_nm' => $address['complexName'] ?? null,
'ptp_no' => $address['pyeongTypeNumber'] ?? null,
'ptp_nm' => $address['pyeongTypeNumber'] ?? null,
'charger' => null,
'req_price_yn' => 'N',
'reg_charger' => null,
'dept1_sq' => null,
'dept2_sq' => null,
'reg_dept2_sq' => null,
'reg_dept1_sq' => null,
'dong_ho_chk' => ($address['isDongHoCheck'] ?? false) ? 'Y' : 'N',
'hscplqry_lv' => $address['inquiryLevel'] ?? null,
'ownerNm' => $seller['ownerName'] ?? null,
'ownerTelNo' => $seller['ownerTelephoneNumber'] ?? null,
'chg_trade_type' => null,
'chg_address2' => null,
'chg_address3' => null,
'chg_seller_tel' => null,
'chg_amt' => null,
'reg_status' => null,
'cupnNo' => null,
'roomSiteAtclRgstCnt' => null,
'roomSiteAtclExpsCnt' => null,
'redvlp_area_nm' => $address['redevelopAreaName'] ?? null,
'biz_stp_desc' => $address['bizStepDescription'] ?? null,
'cert_register' => json_encode($fileExtracted['certRegister'], JSON_UNESCAPED_UNICODE),
'direct_trad_yn' => ($seller['isDirectTrade'] ?? false) ? 'Y' : 'N',
'confirm_doc_img_url' => json_encode($fileExtracted['confirmDocImgUrl'], JSON_UNESCAPED_UNICODE),
'confirm_doc_owner_check_yn' => $ownerCheckYn,
'owner_birth' => null,
'vrfc_type_sub' => $vrfcTypeSub,
'cert_register_save_yn' => $fileExtracted['cert_register_save_yn'] ?? 'N',
'confirm_doc_img_url_save_yn' => $fileExtracted['confirm_doc_img_url_save_yn'] ?? 'N',
'address4' => $address['etcAddress'] ?? null,
'reference_file_url' => !empty($fileExtracted['referenceFileUrl']) ? implode('|', $fileExtracted['referenceFileUrl']) : '',
'reference_file_url_save_yn' => $fileExtracted['reference_file_url_save_yn'] ?? 'N',
'registerBookUniqueNo' => $rawData['verificationReference'] ?? null,
'relationSellerAndOwner' => null,
'ownerTypeCode' => $ownerTypeCode,
'registerBookUniqueNumber' => null
];
}
/**
* 기사 정보 추가 파라미터 생성
*/
public function mapArticleInfoEtc(string $articleNumber, array $rawData): array
{
$address = $rawData['address'] ?? [];
$realtor = $rawData['realtor'] ?? [];
// 공동주택: 동 정보, 비공동: 지번주소
$address2b = ($rawData['realEstateTypeCode'] === 'A01')
? $address['buildingName']
: ($address['jibunAddress'] ?? null);
$ownerTypeCode = $this->mapOwnerTypeCode($rawData['ownerTypeCode'] ?? null);
return [
'atcl_no' => $articleNumber,
'vir_addr_yn' => $this->mapYesNo($address['isVirtualAddress'] ?? null),
'bild_no' => null,
'vrfcMthdTpcd' => null,
'cert_uncnfrm_status' => null,
'expsStartYmdt' => $rawData['exposureStartDateTime'] ?? null,
'vrfcAutoPassYn' => ($rawData['isAutoVerificationRequested'] ?? false) ? 'Y' : 'N',
'address2a' => $address['liAddress'] ?? null,
'address2b' => $address2b,
'registerBookUniqueNo' => null,
'ownerTypeCode' => $ownerTypeCode,
'orgRepCphNo' => null,
'orgRepTelNo' => null,
'orgRltrNm' => null,
'orgRepNm' => null,
'smsSendTime' => null,
'document_cert_method' => null,
'noRgbkVrfcReqYn' => $this->mapYesNo($address['isUnregisteredVerificationRequested'] ?? null),
'areaByBdbkVrfcReqYn' => $this->mapYesNo($address['isBuildingRegisterAreaCheckRequested'] ?? null),
'orgAtclNo' => null,
'atclStatCd' => null,
'repNm' => $realtor['realtorName'] ?? null,
'cpName' => $rawData['cpId'],
'document_not_received' => null,
'final_failure' => null,
];
}
/**
* modify_info 파라미터 생성
*/
public function mapModifyInfo(string $articleNumber, array $rawData, array $payload): array
{
$address = $rawData['address'] ?? [];
$space = $rawData['space'] ?? [];
$price = $rawData['price'] ?? [];
$floor = $rawData['floor'] ?? [];
// 공동주택: 동 정보, 비공동: 지번주소
$address2b = ($rawData['realEstateTypeCode'] === 'A01')
? $address['buildingName']
: ($address['jibunAddress'] ?? null);
return [
// 'atcl_no' => $articleNumber,
'bild_nm' => $address['buildingName'] ?? null,
'rm_no' => $address['hoName'] ?? null,
'floor' => $floor['correspondenceFloorCount'] ?? null,
'floor2' => $floor['totalFloorCount'] ?? null,
'address_code' => $address['legalDivision']['sectorNumber'] ?? null,
'address2' => trim(($address['buildingName'] ?? '') . ' ' . ($address['hoName'] ?? '')),
'address2a' => $address['liAddress'] ?? null,
'address2b' => $address2b,
'address3' => $address['legalDivision']['legalDivisionAddress'] ?? null,
'address4' => $address['etcAddress'] ?? null,
'trade_type' => $rawData['tradeTypeCode'] ?? null,
'deal_amt' => $price['dealAmount'] ?? 0,
'wrrnt_amt' => $price['warrantyAmount'] ?? 0,
'lease_amt' => $price['leaseAmount'] ?? 0,
'isale_amt' => $price['preSaleAmount'] ?? 0,
'prem_amt' => $price['premiumAmount'] ?? 0,
'sply_spc' => $space['supplySpace'] ?? null,
'excls_spc' => $space['exclusiveSpace'] ?? null,
'tot_spc' => $space['totalSpace'] ?? null,
'grnd_spc' => $space['groundSpace'] ?? null,
'bldg_spc' => $space['buildingSpace'] ?? null,
'hscp_no' => $address['complexNumber'] ?? null,
'hscp_nm' => $address['complexName'] ?? null,
'ptp_no' => $address['pyeongTypeNumber'] ?? null,
'ptp_nm' => $address['pyeongTypeNumber'] ?? null,
'modify_yn' => 'N'
];
}
/**
* 인터페이스 구현
*/
public function map(string $articleNumber, array $rawData, array $payload): array
{
return $this->mapVrfcReq($articleNumber, $rawData, $payload);
}
/**
* 요청 타입 매핑
*/
private function mapRequestType(string $requestType): string
{
return match($requestType) {
'REG' => 'C',
'MOD' => 'U',
'CNC' => 'D',
default => '0',
};
}
/**
* 검증 타입 세부 매핑
*/
private function mapVrfcTypeSub(string $vrfcType, string $ownerCheckYn): string
{
return match($vrfcType) {
'D' => $ownerCheckYn === 'Y' ? 'D2' : 'D1',
'N' => 'N2',
default => $vrfcType . '1',
};
}
/**
* boolean을 Y/N으로 변환
*/
private function mapYesNo($value): ?string
{
if ($value === true) return 'Y';
if ($value === false) return 'N';
return null;
}
}

View File

@@ -39,13 +39,13 @@
$serverIp = $_SERVER['SERVER_ADDR'] ?? '';
// 개발 서버
$devServers = ['192.168.200.8', '192.168.10.231'];
$devServers = ['192.168.200.8', '192.168.10.231', '172.18.0.5'];
// 도커 테스트 서버
$dockerServers = ['172.18.0.2'];
// 테스트 서버
$testServers = ['192.168.200.9', '192.168.10.237', '175.126.191.182'];
$testServers = ['192.168.200.9', '192.168.10.237', '175.126.191.182', '192.168.10.243'];
// 운영 서버 IP 매핑
$prodServers = [
@@ -58,7 +58,7 @@
if (in_array($serverIp, $devServers, true)) {
// 개발
echo "<img src='/img/gnb_dev_00.png' alt='' />";
echo "개발";
} elseif (in_array($serverIp, $dockerServers, true)) {
// 도커
@@ -80,8 +80,6 @@
echo "{$serverName}";
}
?>
</li>

View File

@@ -26,7 +26,7 @@
<legend class="fs-6 fw-semibold mb-2">컨펌스 시스템 비밀번호 작성규칙</legend>
<ul class="mb-0 ps-3">
<li class="mb-2">
<div class="fw-semibold">- 최소길이</div>
<div class="fw-semibold">최소길이</div>
<div class="text-muted small">
최소 8자리 이상 : 영어 대문자, 소문자, 숫자, 특수문자 최소 2종류 조합
</div>

View File

@@ -6,9 +6,16 @@ $usr_level = session('usr_level');
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;

View File

@@ -718,7 +718,7 @@ $usr_nm = session('usr_nm');
const rcpt_key = rowData.rcpt_key;
location.href = "<?= site_url('article/dept/detail') ?>/" + rcpt_key;
window.open("<?= site_url('article/dept/detail') ?>/" + rcpt_key, '_blank');
});
$(document).on('change', '#chkAll', function () {

View File

@@ -2,9 +2,16 @@
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;

View File

@@ -749,7 +749,7 @@
if (!rowData) return;
const id = rowData.rcpt_no;
location.href = "<?= site_url('article/apt/detail') ?>/" + id;
window.open("<?= site_url('article/apt/detail') ?>/" + id, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -109,7 +109,6 @@ $usr_nm = session('usr_nm');
<div class="main-card mb-3 card">
<div class="card-body">
<form id="frm_srch_info" method="get" onsubmit="return false;">
<!-- 검색 폼 -->
<div class="row g-3">
<div class="col-md-1">
@@ -175,19 +174,20 @@ $usr_nm = session('usr_nm');
<label class="form-label mb-1">현재상태</label>
<div class="d-flex gap-1">
<select name="rcpt_stat1" class="form-select form-select-sm">
<option value="">예약확인지연</option>
<option value="">선택</option>
<?php foreach ($codes as $c): ?>
<?php if ($c['category'] === "STEP_VERIFICATION"): ?>
<option value="<?= $c['cd'] ?>"><?= $c['cd_nm'] ?></option>
<?php endif; ?>
<?php endforeach; ?>
</select>
<select name="rcpt_stat2" id="srcGugun" class="form-select form-select-sm">
<!-- <select name="rcpt_stat2" id="srcGugun" class="form-select form-select-sm">
<option value="">-상태2-</option>
</select>
<select name="rcpt_stat3" id="srcDong" class="form-select form-select-sm">
<option value="">-상태3-</option>
</select>
</select> -->
</div>
</div>
@@ -404,6 +404,13 @@ $usr_nm = session('usr_nm');
const bonbuArr = <?= json_encode($bonbu, JSON_UNESCAPED_UNICODE); ?>;
const teamArr = <?= json_encode($team, JSON_UNESCAPED_UNICODE); ?>;
const userArr = <?= json_encode($user, JSON_UNESCAPED_UNICODE); ?>;
<?php if (isset($srchUser) && !empty($srchUser)): ?>
const srchUser = <?= json_encode($srchUser, JSON_UNESCAPED_UNICODE); ?>;
<?php else: ?>
const srchUser = null;
<?php endif; ?>
const sBonbu = "<?= $sBonbu ?? '' ?>";
const sTeam = "<?= $sTeanm ?? '' ?>";
const date = new Date();
var table;
@@ -412,6 +419,15 @@ $usr_nm = session('usr_nm');
initReceiptDate();
// srchUser 데이터가 있으면 초기값 설정 (usr_id 파라미터)
if (srchUser) {
initSrchUser();
}
// bonbu, dept_sq 파라미터가 있으면 초기값 설정
else if (sBonbu || sTeam) {
initSrchParam();
}
$("#srcSido, #srcGugun, #srcSido2, #srcGugun2").on("change", function (e) {
const targetId = this.id;
@@ -640,7 +656,7 @@ $usr_nm = session('usr_nm');
{ data: null, render: fn_prd_render },
{ data: 'rcpt_product_info1' },
<?php if ($usr_level != "45"): ?>
{ data: 'dept_nm' },
{ data: 'dept_nm' },
{ data: 'usr_nm' },
<?php endif; ?>
{ data: 'parcel_out_yn' },
@@ -669,7 +685,7 @@ $usr_nm = session('usr_nm');
if (!rowData) return;
const rcpt_atclno = rowData.rcpt_atclno;
location.href = "<?= site_url('article/receipt/detail') ?>/" + rcpt_atclno;
window.open("<?= site_url('article/receipt/detail') ?>/" + rcpt_atclno, '_blank');
});
@@ -710,6 +726,79 @@ $usr_nm = session('usr_nm');
}
// 검색 사용자 초기화 (usr_id 파라미터용)
function initSrchUser() {
if (!srchUser) return;
const pdept_sq = srchUser.pdept_sq;
const dept_sq = srchUser.dept_sq;
const usr_id = srchUser.usr_id;
// 1단계: 본부 선택
if (pdept_sq) {
$("#bonbu").val(pdept_sq);
// 2단계: 팀 목록 로드 및 선택
let teamStr = `<option value="">-팀-</option>`;
if (teamArr.length > 0) {
for (let i = 0; i < teamArr.length; i++) {
if (String(teamArr[i].pdept_sq) === String(pdept_sq)) {
const selected = String(teamArr[i].dept_sq) === String(dept_sq) ? 'selected' : '';
teamStr += `<option value="${teamArr[i].dept_sq}" ${selected}>${teamArr[i].dept_nm}</option>`;
}
}
}
$("#team").html(teamStr);
// 3단계: 담당자 목록 로드 및 선택
if (dept_sq) {
let damdangStr = `<option value="">-담당자-</option>`;
if (userArr.length > 0) {
for (let i = 0; i < userArr.length; i++) {
if (String(userArr[i].dept_sq) === String(dept_sq)) {
const selected = String(userArr[i].usr_id) === String(usr_id) ? 'selected' : '';
damdangStr += `<option value="${userArr[i].usr_id}" ${selected}>${userArr[i].usr_nm}</option>`;
}
}
}
$("#damdang").html(damdangStr);
}
}
}
// 검색 파라미터 초기화 (bonbu, dept_sq 파라미터용)
function initSrchParam() {
// 1단계: 본부 선택
if (sBonbu) {
$("#bonbu").val(sBonbu);
// 2단계: 팀 목록 로드 및 선택
let teamStr = `<option value="">-팀-</option>`;
if (teamArr.length > 0) {
for (let i = 0; i < teamArr.length; i++) {
if (String(teamArr[i].pdept_sq) === String(sBonbu)) {
const selected = String(teamArr[i].dept_sq) === String(sTeam) ? 'selected' : '';
teamStr += `<option value="${teamArr[i].dept_sq}" ${selected}>${teamArr[i].dept_nm}</option>`;
}
}
}
$("#team").html(teamStr);
// 3단계: 팀이 선택되어 있으면 담당자 목록 로드
if (sTeam) {
let damdangStr = `<option value="">-담당자-</option>`;
if (userArr.length > 0) {
for (let i = 0; i < userArr.length; i++) {
if (String(userArr[i].dept_sq) === String(sTeam)) {
damdangStr += `<option value="${userArr[i].usr_id}">${userArr[i].usr_nm}</option>`;
}
}
}
$("#damdang").html(damdangStr);
}
}
}
function atcl_no_enter(event) {
if (event.keyCode == 13) {
table.ajax.reload()

View File

@@ -6,9 +6,16 @@ $usr_level = session('usr_level');
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;

View File

@@ -520,7 +520,7 @@ $usr_nm = session('usr_nm');
if (!rowData) return;
const rcpt_key = rowData.rcpt_key;
location.href = "<?= site_url('article/record/detail') ?>/" + rcpt_key;
window.open("<?= site_url('article/record/detail') ?>/" + rcpt_key, '_blank');
});

View File

@@ -337,7 +337,9 @@
const row = table.row(this).data()
if (!row) return
location.href = '/article/receipt/lists';
location.href = '/article/receipt/lists?usr_id=' + row.usr_id;
});
// [검색] 버튼 눌렀을 때 다시 조회

View File

@@ -144,13 +144,14 @@
$nRow = 1;
foreach ($st_list as $row) {
// if ($row['depth'] == '1') {
// $rowPars = array_merge($pars, array('bonbu' => $row['dept_sq']));
// } else {
// $rowPars = array_merge($pars, array('bonbu' => $row['pdept_sq'], 'dept_sq' => $row['dept_sq']));
// }
echo '<tr onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'normal\'" style="cursor:pointer" onclick="tr_onclick();">';
$pars = [];
if ($row['depth'] == '1') {
$rowPars = array_merge($pars, array('bonbu' => $row['dept_sq']));
} else {
$rowPars = array_merge($pars, array('bonbu' => $row['pdept_sq'], 'dept_sq' => $row['dept_sq']));
}
echo '<tr onmouseover="this.className=\'highlight\'" onmouseout="this.className=\'normal\'" style="cursor:pointer" onclick="tr_onclick(\'' . make_query_string($rowPars) . '\');">';
echo '<td>' . $nRow . '</td>';
echo '<td style="text-align:left">' . str_replace(' ', '&nbsp;', $row['dept_nm']) . '</td>';
echo '<td>' . $row['region_cnt'] . '</td>';
@@ -231,8 +232,8 @@
});
function tr_onclick() {
location.href = '/article/receipt/lists';
function tr_onclick(pars) {
location.href = '/article/receipt/lists' + pars;
}
// 엑셀 다운로드

View File

@@ -326,7 +326,7 @@
// myModal.show();
location.href = '/article/receipt/lists';
location.href = '/article/receipt/lists?usr_id=' + row.usr_id;
});

File diff suppressed because it is too large Load Diff

View File

@@ -554,7 +554,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m701/m701a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m701/m701a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -578,7 +578,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m702/m702a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m702/m702a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -2,9 +2,16 @@
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;
@@ -156,7 +163,7 @@
style="max-width: 320px;">
<input type="text" class="form-control"
name="atcl_no" id="atcl_no"
value="<?= $data['atcl_no'] ?>" maxlength="10"
value="<?= $data['fax_sq'] ?>" maxlength="10"
placeholder="매물번호 입력">
<button type="button"
class="btn btn-outline-primary"
@@ -239,7 +246,8 @@
<span class="fw-semibold">중개인 요청사항</span>
</div>
<div class="card-body p-2">
<table class="table table-sm table-bordered mb-0 tbl_basic2 align-middle" id="info_table">
<table class="table table-sm table-bordered mb-0 tbl_basic2 align-middle"
id="info_table">
<colgroup>
<col style="width: 120px;">
<col>
@@ -270,7 +278,8 @@
<span class="fw-semibold">매물 정보</span>
</div>
<div class="card-body p-2">
<table class="table table-sm table-bordered mb-0 tbl_basic2 align-middle" id="info_table">
<table class="table table-sm table-bordered mb-0 tbl_basic2 align-middle"
id="info_table">
<colgroup>
<col style="width: 120px;">
<col>
@@ -640,7 +649,8 @@
</div>
<div class="card-body p-2">
<table class="table table-sm table-bordered mb-2 tbl_basic2 align-middle">
<table
class="table table-sm table-bordered mb-2 tbl_basic2 align-middle">
<colgroup>
<col style="width: 140px;">
<col>
@@ -1568,7 +1578,7 @@
}
Swal.fire({
title: msg,
title: "매물조회 실패",
icon: "error"
})
},

View File

@@ -532,7 +532,7 @@
if (!rowData) return;
const fax_sq = rowData.fax_sq;
location.href = "<?= site_url('m703/m703a/detail') ?>/" + fax_sq;
window.open("<?= site_url('m703/m703a/detail') ?>/" + fax_sq, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -530,7 +530,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m704/m704a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m704/m704a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -26,6 +26,9 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
$file_pdf = 'pdf';
}
$regi_pdf_path = $arr_cert_register[0];
if ($regist['cloud_upload_yn'] == 'Y') {
$regi_pdf_path = NCLOUD_OBJECT_STORAGE_URL . $regi_pdf_path;
}
} else {
if (empty($regist['file_name'])) {
@@ -35,6 +38,9 @@ if (!empty($data['cert_register']) && $data['cert_register_save_yn'] != 'Y') { /
$file_pdf = substr($regist['file_name'], -3);
$regi_pdf_path = $regist['file_path'] . $regist['file_name']; //등기부등본
if ($regist['cloud_upload_yn'] == 'Y') {
$regi_pdf_path = NCLOUD_OBJECT_STORAGE_URL . $regi_pdf_path;
}
}
}
@@ -52,9 +58,16 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<?= $this->extend('layouts/main') ?>
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;
@@ -87,7 +100,7 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="col-12">
<div class="main-card mb-3 card">
<div class="card-body">
<form id="rcptFrm" onsubmit="return false">
<form id="rcptFrm" name="rcptFrm" onsubmit="return false">
<input type="hidden" name="reg_chk_val" value="<?= $data['rgbk_confirm'] ?>" />
<input type="hidden" name="atcl_vrtc_type" id="atcl_vrtc_type"
value="<?= $data['vrfc_type_cd'] ?>" />
@@ -143,6 +156,7 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
}
}
echo '</div><br>';
}
}
} else {
@@ -163,8 +177,10 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
}
?>
<iframe src="<?= $regi_img_path ?>" frameborder="0"
style="padding: 10px 0;width:100%; height:1200px;"></iframe><br>
<img src="<?= $regi_img_path ?>" alt="">
<!-- <iframe src="<?= $regi_img_path ?>" frameborder="0"
style="padding: 10px 0;width:100%; height:1200px;"></iframe><br> -->
<br>
<a href="<?= $regi_pdf_path ?>" class="default_val" target="_blank">등기부등본
보기</a>&nbsp;&nbsp;&nbsp;
@@ -383,62 +399,64 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
</tr>
</table>
<?php endif; ?>
<?php if (in_array($detail_hscp['villaType'], $villa_rlet_type_cd)): ?>
<table width="100%">
<tr>
<th>단지명</th>
<td>
<?= $detail_hscp['villaName']; ?>
</td>
<th>단지타입명</th>
<td>
<?= $detail_hscp['villaTypeName']; ?>
</td>
</tr>
<tr>
<th>소재법정동번호</th>
<td colspan="3">
<?= $detail_hscp['cortarNo']; ?>
</td>
</tr>
<tr>
<th>소재 주소(전체)</th>
<td colspan="3">
<?= $detail_hscp['addr']; ?>
</td>
</tr>
<tr>
<th>주소(광역시/도)</th>
<td>
<?= $detail_hscp['city']; ?>
</td>
<th>주소(시군구)</th>
<td>
<?= $detail_hscp['dvsn']; ?>
</td>
</tr>
<tr>
<th>주소(읍면동)</th>
<td>
<?= $detail_hscp['sec']; ?>
</td>
<th>소재 동이하 상세주소</th>
<td>
<?= $detail_hscp['dtlAddr']; ?>
</td>
</tr>
<tr>
<th>단지 총 세대수</th>
<td>
<?= $detail_hscp['totHsehCnt']; ?>
</td>
<th>단지 총 동수</th>
<td>
<?= $detail_hscp['totDongCnt']; ?>
</td>
</tr>
<?php if (!empty($detail_hscp['villaType'])): ?>
<?php if (in_array($detail_hscp['villaType'], $villa_rlet_type_cd)): ?>
<table width="100%">
<tr>
<th>단지명</th>
<td>
<?= $detail_hscp['villaName']; ?>
</td>
<th>단지타입명</th>
<td>
<?= $detail_hscp['villaTypeName']; ?>
</td>
</tr>
<tr>
<th>소재법정동번호</th>
<td colspan="3">
<?= $detail_hscp['cortarNo']; ?>
</td>
</tr>
<tr>
<th>소재 주소(전체)</th>
<td colspan="3">
<?= $detail_hscp['addr']; ?>
</td>
</tr>
<tr>
<th>주소(광역시/도)</th>
<td>
<?= $detail_hscp['city']; ?>
</td>
<th>주소(시군구)</th>
<td>
<?= $detail_hscp['dvsn']; ?>
</td>
</tr>
<tr>
<th>주소(읍면동)</th>
<td>
<?= $detail_hscp['sec']; ?>
</td>
<th>소재 동이하 상세주소</th>
<td>
<?= $detail_hscp['dtlAddr']; ?>
</td>
</tr>
<tr>
<th>단지 총 세대수</th>
<td>
<?= $detail_hscp['totHsehCnt']; ?>
</td>
<th>단지 총 동수</th>
<td>
<?= $detail_hscp['totDongCnt']; ?>
</td>
</tr>
</table>
</table>
<?php endif; ?>
<?php endif; ?>
</td>
</tr>
@@ -692,6 +710,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<td>
<table class="w-100 tbl_basic2 table-bordered">
<tr>
<input type="hidden" name="arr_uncnfrm_status"
id="arr_uncnfrm_status" />
<?php
$checks = explode('|', $data['comment']);
// if (in_array($confirm['code_d11'], ['20011', '20012'])) {
@@ -844,7 +864,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="img_chk_chk3_area">
<input class="form-check-input" type="checkbox"
id="img_chk_chk3">
name="img_chk_chk" id="img_chk_chk3"
onclick="check_only(this)">
<label class="form-check-label"
for="img_chk_chk3">열람</label>
</div>
@@ -852,7 +873,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="img_chk_chk4_area">
<input class="form-check-input" type="checkbox"
id="img_chk_chk4">
name="img_chk_chk" id="img_chk_chk4"
onclick="check_only(this)">
<label class="form-check-label"
for="img_chk_chk4">소유자명 확인</label>
</div>
@@ -861,7 +883,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="img_chk_chk5_area">
<input class="form-check-input" type="checkbox"
id="img_chk_chk5">
name="img_chk_chk" id="img_chk_chk5"
onclick="check_only(this)">
<label class="form-check-label"
for="img_chk_chk5">리얼탑 열람</label>
</div>
@@ -869,7 +892,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="img_chk_chk6_area">
<input class="form-check-input" type="checkbox"
id="img_chk_chk6">
name="img_chk_chk" id="img_chk_chk6"
onclick="check_only(this)">
<label class="form-check-label"
for="img_chk_chk6">리얼탑 기열람</label>
</div>
@@ -877,7 +901,8 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="img_chk_chk2_area">
<input class="form-check-input" type="checkbox"
id="img_chk_chk2">
name="img_chk_chk" id="img_chk_chk2"
onclick="check_only(this)">
<label class="form-check-label"
for="img_chk_chk2">등기소</label>
</div>
@@ -886,7 +911,7 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
<div class="form-check align-items-center mb-0"
id="noimg_chk_chk_area">
<input class="form-check-input mt-0" type="checkbox"
id="noimg_chk_chk">
name="noimg_chk_chk" id="noimg_chk_chk">
<label class="form-check-label small"
for="noimg_chk_chk">
이미지 파일 없음
@@ -1334,6 +1359,15 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
});
function check_only(chk) {
var obj = document.getElementsByName("img_chk_chk");
for (var i = 0; i < obj.length; i++) {
if (obj[i] != chk) {
obj[i].checked = false;
}
}
}
// 이미지회전
function faximage_rotate(degress) {
@@ -1547,6 +1581,11 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
var trade_type = "<?= $data['trade_type_cd'] ?>";
var vrfc_type = "<?= $data['vrfc_type_cd'] ?>";
var chkBox = $('input:checkbox[name=img_chk_chk]').is(':checked'); //등기소, 리얼탑 열람, 리얼탑 기열람, 열람
var cert_register = "<?= $data['cert_register'] ?>"; //등기부등본 url이 있을경우
var filePdf = '<?= $file_pdf ?>';
if (vrfc_type == "M") {
// 검증방식이 모바일이면 파일체크는 하지않고 열람인지 등기소, 리얼탑 열람, 리얼탑 기열람인지만 체크함
if (chkBox == false) {
@@ -1678,23 +1717,79 @@ if (!empty($data['confirm_doc_img_url']) && $data['confirm_doc_img_url_save_yn']
}
// 다중체크된거 가져오기
var arr_uncnfrm_status = "";
var cnt = 0;
$('input:checkbox[name="cert_uncnfrm_status[]"]').each(function () {
if ($(this).is(':checked')) {
if (cnt == 0) {
arr_uncnfrm_status += $(this).val();
} else {
arr_uncnfrm_status += "|" + ($(this).val());
}
cnt++;
}
var arr_uncnfrm_status = [];
$('input:checkbox[name="cert_uncnfrm_status[]"]:checked').each(function () {
arr_uncnfrm_status.push($(this).val());
});
$('#arr_uncnfrm_status').val(arr_uncnfrm_status);
var uncnfrm_status_str = arr_uncnfrm_status.join('|');
console.log('====')
console.log(uncnfrm_status_str)
console.log('====')
$('#arr_uncnfrm_status').val(uncnfrm_status_str);
}
console.log(frm.serialize())
swal.fire({
text: "저장 하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
closeOnConfirm: false,
closeOnCancel: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/m705/m705a/saveRegi',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: $("#rcptFrm").serialize(),
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
Swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
})
location.reload();
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
}

View File

@@ -569,7 +569,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m705/m705a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m705/m705a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -481,7 +481,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m706/m706a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m706/m706a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -5,9 +5,16 @@ $usr_level = session('usr_level');
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;
@@ -34,9 +41,9 @@ $usr_level = session('usr_level');
<div class="row">
<div class="col-12">
<form action="">
<form action="" id="frmSave" name="frmSave" onsubmit="return false;">
<input type="hidden" name="work_type" id="work_type" value="<?= $data['work_type'] ?>" />
<input type="hidden" name="atcl_no" id="atcl_no" value="<?= $data['atcl_no'] ?>" />
<input type="hidden" name="atcl_no" value="<?= $data['atcl_no'] ?>" />
<input type="hidden" name="vr_sq" id="vr_sq" value="<?= $data['vr_sq'] ?>" />
<input type="hidden" name="fax_sq" id="fax_sq" value="<?= $data['fax_sq'] ?>" />
<input type="hidden" name="file_type" id="file_type" value="" />
@@ -167,7 +174,7 @@ $usr_level = session('usr_level');
style="max-width: 320px;">
<input type="text" class="form-control"
name="atcl_no" id="atcl_no"
value="<?= $data['atcl_no'] ?>" maxlength="10"
value="<?= $data['fax_sq'] ?>" maxlength="10"
placeholder="매물번호 입력">
<button type="button"
class="btn btn-outline-primary"
@@ -336,7 +343,7 @@ $usr_level = session('usr_level');
<?php else: ?>
<input type="text" class="form-control form-control-sm"
name="address3" id="address3"
value="<?= $article['rcpt_ho'] ?>" disabled>
value="<?= $article['rcpt_ho'] ?? '' ?>" disabled>
<?php endif; ?>
<button type="button"
class="btn btn-sm btn-outline-light">매물확인</button>
@@ -351,7 +358,7 @@ $usr_level = session('usr_level');
<?php else: ?>
<input type="text" class="form-control form-control-sm"
name="address3" id="address3"
value="<?= $article['rcpt_ho'] ?>" disabled>
value="<?= $article['rcpt_ho'] ?? '' ?>" disabled>
<?php endif; ?>
<?php endif; ?>
<button type="button"
@@ -662,26 +669,52 @@ $usr_level = session('usr_level');
return;
}
location.replace("<?= site_url('m708/m708a/detail') ?>/" + atclNo);
/*
var atclNo = $('#atcl_no').val();
if (atclNo == "") {
swal.fire({
title: "매물번호를 입력해 주세요.",
icon: "warning"
});
return;
}
$.getJSON("/m708/m708a/getArticleInfo?&atcl_no=" + atclNo, function (res) {
if (res.code == '0') {
if (res.vr_sq != null) {
location.replace("<?= site_url('m708/m708a/detail') ?>/" + vr_sq);
} else {
swal.fire({
title: "매물 조회에 실패했습니다.",
icon: "warning"
});
}
} else {
swal.fire({
title: "매물 조회에 실패했습니다.",
icon: "warning"
});
}
} else {
swal.fire({
title: "잠시후 다시 시도해 주세요.",
icon: "warning"
});
}
swal.fire({
title: "잠시후 다시 시도해 주세요.",
icon: "warning"
});
}
});
*/
}
// 매물확인
function view201detail(atcl_no) {
var type = <?= $data['work_type'] ?? '' ?>;
if (type == '1') { //현장확인매물
window.open('/article/receipt/detail/' + atcl_no);
} else {
alert('현장확인 매물이 아닙니다.');
return;
}
}
// 현장확인
@@ -1212,7 +1245,7 @@ $usr_level = session('usr_level');
}).then((result) => {
if (result.isConfirmed) {
$.ajax({
url: '/m703/m703a/saveResult',
url: '/m708/m708a/saveResult',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: $("#frmSave").serialize(),
@@ -1306,11 +1339,15 @@ $usr_level = session('usr_level');
},
success: function (result) {
if (result.code == '0') {
if (parseInt(result.cnt) >= 4) {
Swal.fire({
title: '분양계약서가 업로드 되어 있습니다.',
icon: "warning"
const fax_sq = result.data.fax_sq;
location.replace("<?= site_url('m708/m708a/detail') ?>/" + fax_sq);
})
} else {
upload_bunyang();
}
} else {
Swal.fire({
title: result.msg,
@@ -1323,6 +1360,84 @@ $usr_level = session('usr_level');
});
}
// 분양계약서 업로드
function upload_bunyang() {
var vr_sq = $('#frmSave > #vr_sq').val();
var work_type = $('#frmSave > #work_type').val();
var atcl_no = $('#frmSave > #atcl_no').val();
if (work_type == '' || atcl_no == '' || vr_sq == '') {
swal.fire({
title: "매물정보를 확인하세요.",
icon: "warning"
});
return false;
} else {
swal.fire({
text: "확인결과를 저장하시겠습니까?",
type: "warning",
showCancelButton: true,
confirmButtonText: "예",
cancelButtonText: "아니오",
closeOnConfirm: false,
closeOnCancel: true,
confirmButtonColor: "#3085d6",
cancelButtonColor: "#d33",
}).then((result) => {
if (result.isConfirmed) {
const data = {
'curr_fax_sq': '<?= $data['fax_sq'] ?>'
};
$.ajax({
url: '/m708/m708a/saveResult3',
contentType: 'application/x-www-form-urlencoded;charset=UTF-8',
method: 'POST',
data: data,
beforeSend: function () {
blockUI.blockPage({
message: tpl
})
},
complete: function () {
blockUI.unblockPage()
},
error: function (xhr, error, thrown) {
blockUI.unblockPage()
var msg = "";
if (xhr.responseText != null) {
msg = xhr.responseText
} else {
msg = "잠시후 다시 시도해 주세요."
}
Swal.fire({
title: msg,
icon: "error"
})
},
success: function (result) {
if (result.code == '0') {
swal.fire({
title: '정상 처리되었습니다.',
icon: "success"
});
location.reload();
} else {
Swal.fire({
title: result.msg,
icon: "error"
})
}
}
});
}
});
}
}
// 다음매물
function btnSilverNextAssign_onclick() {
swal.fire({

View File

@@ -557,7 +557,7 @@
if (!rowData) return;
const fax_sq = rowData.fax_sq;
location.href = "<?= site_url('m708/m708a/detail') ?>/" + fax_sq;
window.open("<?= site_url('m708/m708a/detail') ?>/" + fax_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -5,9 +5,16 @@ $usr_level = session('usr_level');
<?= $this->section('content') ?>
<style>
table th {
vertical-align: middle;
line-height: 1.2;
}
.tbl_basic2 th {
padding: 0 10px;
height: 27px;
line-height: 27px;
vertical-align: middle;
border: solid 1px #d8d9de;
background-color: #eff0f4;
letter-spacing: -1px;
@@ -36,7 +43,7 @@ $usr_level = session('usr_level');
<div class="col-12">
<form action="">
<input type="hidden" name="work_type" id="work_type" value="<?= $data['work_type'] ?>" />
<input type="hidden" name="atcl_no" id="atcl_no" value="<?= $data['atcl_no'] ?>" />
<input type="hidden" name="atcl_no" value="<?= $data['atcl_no'] ?>" />
<input type="hidden" name="vr_sq" id="vr_sq" value="<?= $data['vr_sq'] ?>" />
<input type="hidden" name="fax_sq" id="fax_sq" value="<?= $data['fax_sq'] ?>" />
<input type="hidden" name="file_type" id="file_type" value="" />
@@ -146,7 +153,7 @@ $usr_level = session('usr_level');
style="max-width: 320px;">
<input type="text" class="form-control"
name="atcl_no" id="atcl_no"
value="<?= $data['atcl_no'] ?>" maxlength="10"
value="<?= $data['fax_sq'] ?>" maxlength="10"
placeholder="매물번호 입력">
<button type="button"
class="btn btn-outline-primary"
@@ -662,25 +669,29 @@ $usr_level = session('usr_level');
return;
}
location.replace("<?= site_url('m709/m709a/detail') ?>/" + atclNo);
/*
$.getJSON("/m709/m709a/getArticleInfo?&atcl_no=" + atclNo, function (res) {
if (res.code == '0') {
if (res.vr_sq != null) {
location.replace("<?= site_url('m708/m708a/detail') ?>/" + vr_sq);
} else {
swal.fire({
title: "매물 조회에 실패했습니다.",
icon: "warning"
});
}
} else {
swal.fire({
title: "매물 조회에 실패했습니다.",
icon: "warning"
});
}
} else {
swal.fire({
title: "잠시후 다시 시도해 주세요.",
icon: "warning"
});
}
swal.fire({
title: "잠시후 다시 시도해 주세요.",
icon: "warning"
});
}
});
*/
}

View File

@@ -557,7 +557,7 @@
if (!rowData) return;
const fax_sq = rowData.fax_sq;
location.href = "<?= site_url('m709/m709a/detail') ?>/" + fax_sq;
window.open("<?= site_url('m709/m709a/detail') ?>/" + fax_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -560,7 +560,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m701/m701a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m701/m701a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -551,7 +551,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m712/m712a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m712/m712a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

File diff suppressed because it is too large Load Diff

View File

@@ -570,7 +570,7 @@
if (!rowData) return;
const vr_sq = rowData.vr_sq;
location.href = "<?= site_url('m713/m713a/detail') ?>/" + vr_sq;
window.open("<?= site_url('m713/m713a/detail') ?>/" + vr_sq, '_blank');
});
$('#btnSearch').on('click', function () {

View File

@@ -0,0 +1 @@
/* (deprecated) overrides removed */