아파트평면도 목록 페이지 추가
This commit is contained in:
@@ -166,11 +166,17 @@ class Apt extends BaseController
|
||||
$damdang = $this->request->getPost(index: 'damdang');
|
||||
|
||||
if (empty($team)) {
|
||||
throw new Exception("팀정보 누락");
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '팀정보 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
if (empty($damdang)) {
|
||||
throw new Exception("담당자정보 누락");
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '담당자정보 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +198,10 @@ class Apt extends BaseController
|
||||
|
||||
}
|
||||
} else {
|
||||
throw new Exception("저장할 데이터 누락");
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '저장데이터 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
@@ -262,8 +271,6 @@ class Apt extends BaseController
|
||||
// 엑셀 다운로드
|
||||
public function excel()
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
|
||||
$data = [
|
||||
|
||||
@@ -4,6 +4,11 @@ namespace App\Controllers\Article;
|
||||
use App\Controllers\BaseController;
|
||||
use App\Models\article\DelChgAptModel;
|
||||
|
||||
/**
|
||||
* 단지코드관리
|
||||
* 2025.12.26
|
||||
* 작성자 : yangsh
|
||||
*/
|
||||
class DelChgApt extends BaseController
|
||||
{
|
||||
private $model;
|
||||
|
||||
358
app/Controllers/Article/Ground.php
Normal file
358
app/Controllers/Article/Ground.php
Normal file
@@ -0,0 +1,358 @@
|
||||
<?php
|
||||
namespace App\Controllers\Article;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Models\article\GroundModel;
|
||||
use App\Models\common\CodeModel;
|
||||
|
||||
/**
|
||||
* 아파트 평면도
|
||||
* 2025.12.26
|
||||
* 작성자 : yangsh
|
||||
*/
|
||||
class Ground extends BaseController
|
||||
{
|
||||
private $model, $codeModel;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = new GroundModel();
|
||||
$this->codeModel = new CodeModel();
|
||||
}
|
||||
|
||||
public function lists(): string
|
||||
{
|
||||
|
||||
$codes = $this->codeModel->getCodeLists(['VIDEO_TARGET', 'APT_GROUND_STEP', 'PHO_YN', 'VDO_YN']); // 코드조회
|
||||
$sido = $this->model->getAreaList(); // 지역조회
|
||||
$bonbu = $this->model->getBonbuList(); // 본부
|
||||
$team = $this->model->getTeamList(); // 팀
|
||||
$user = $this->model->getUserList(); // 유저
|
||||
|
||||
return view("pages/article/lists2", [
|
||||
'codes' => $codes,
|
||||
'sido' => $sido,
|
||||
'bonbu' => $bonbu,
|
||||
'team' => $team,
|
||||
'user' => $user,
|
||||
]);
|
||||
}
|
||||
|
||||
// 아파트단지목록 조회
|
||||
public function getAptLists()
|
||||
{
|
||||
|
||||
$start = (int) $this->request->getGet('start') ?: 0;
|
||||
$end = (int) $this->request->getGet('length') ?: 10;
|
||||
|
||||
$data = [
|
||||
'hscp_no' => $this->request->getGet('hscp_no'), // 단지코드
|
||||
'part_no' => $this->request->getGet('part_no'), // 구분코드
|
||||
'srcSido' => $this->request->getGet('srcSido'), // 시|도
|
||||
'srcGugun' => $this->request->getGet('srcGugun'), // 시|군|구
|
||||
'srcDong' => $this->request->getGet('srcDong'), // 읍|면|동
|
||||
|
||||
'rcpt_hscp_nm' => $this->request->getGet('rcpt_hscp_nm'), // 단지명
|
||||
'sdate' => $this->request->getGet('sdate'), // 시작일
|
||||
'edate' => $this->request->getGet('edate'), // 종료일
|
||||
|
||||
'bonbu' => $this->request->getGet('bonbu'), // 본부
|
||||
'team' => $this->request->getGet('team'), // 팀
|
||||
'damdang' => $this->request->getGet('damdang'), // 담당
|
||||
|
||||
'stat' => $this->request->getGet('stat'), // 진행상태
|
||||
];
|
||||
|
||||
$totalCount = $this->model->getTotalCount($data);
|
||||
$datas = $this->model->getAptLists($start, $end, $data);
|
||||
|
||||
$deptStatistics = $this->model->getDeptStatistics($data); // 조직별통계
|
||||
$areaStatistics = $this->model->getStatistics($data); // 지역별통계
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'draw' => (int) ($this->request->getGetPost('draw') ?? 0), // 서버사이드면 권장
|
||||
'recordsTotal' => $totalCount,
|
||||
'recordsFiltered' => $totalCount,
|
||||
'data' => $datas,
|
||||
'widgets' => [
|
||||
'deptList' => $deptStatistics,
|
||||
'areaStats' => $areaStatistics,
|
||||
],
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
// 엑셀 다운로드
|
||||
public function excel()
|
||||
{
|
||||
try {
|
||||
|
||||
$data = [
|
||||
'hscp_no' => $this->request->getGet('hscp_no'), // 단지코드
|
||||
'part_no' => $this->request->getGet('part_no'), // 구분코드
|
||||
'srcSido' => $this->request->getGet('srcSido'), // 시|도
|
||||
'srcGugun' => $this->request->getGet('srcGugun'), // 시|군|구
|
||||
'srcDong' => $this->request->getGet('srcDong'), // 읍|면|동
|
||||
|
||||
'rcpt_hscp_nm' => $this->request->getGet('rcpt_hscp_nm'), // 단지명
|
||||
'sdate' => $this->request->getGet('sdate'), // 시작일
|
||||
'edate' => $this->request->getGet('edate'), // 종료일
|
||||
|
||||
'bonbu' => $this->request->getGet('bonbu'), // 본부
|
||||
'team' => $this->request->getGet('team'), // 팀
|
||||
'damdang' => $this->request->getGet('damdang'), // 담당
|
||||
|
||||
'stat' => $this->request->getGet('stat'), // 진행상태
|
||||
];
|
||||
|
||||
$datas = $this->model->getExcelList($data);
|
||||
|
||||
return $this->response->setJSON(body: [
|
||||
'data' => $datas,
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$e->getPrevious()->getTraceAsString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 관할포인트 인쇄 - 화면
|
||||
public function print(): string
|
||||
{
|
||||
$deptSq = $this->request->getGet('depChk');
|
||||
$dept_cnt = count($deptSq);
|
||||
|
||||
|
||||
$listDept = $this->model->getDeptMapList($deptSq);
|
||||
|
||||
if (!empty($listDept)) {
|
||||
$lati = 0;
|
||||
$long = 0;
|
||||
foreach ($listDept as $dept) {
|
||||
$lati += $dept['rcpt_y'];
|
||||
$long += $dept['rcpt_x'];
|
||||
}
|
||||
|
||||
$lati = $lati / $dept_cnt;
|
||||
$long = $long / $dept_cnt;
|
||||
}
|
||||
|
||||
return view("pages/article/printMap", [
|
||||
// 'lati' => $lati,
|
||||
// 'long' => $long,
|
||||
'listDept' => $listDept,
|
||||
]);
|
||||
}
|
||||
|
||||
// 담당자정보변경
|
||||
public function chgAptDamdang()
|
||||
{
|
||||
try {
|
||||
|
||||
$team = $this->request->getPost('team');
|
||||
$damdang = $this->request->getPost(index: 'damdang');
|
||||
|
||||
if (empty($team)) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '팀정보 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
if (empty($damdang)) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '담당자정보 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$rows = $this->request->getPost('rows');
|
||||
|
||||
$rows = json_decode($rows, true);
|
||||
|
||||
if (count($rows) > 0) {
|
||||
foreach ($rows as $row) {
|
||||
$params = [
|
||||
$team,
|
||||
$damdang,
|
||||
$row['rcpt_no'],
|
||||
];
|
||||
|
||||
|
||||
// UPDATE apt_result
|
||||
$this->model->updateAptDamdang($params);
|
||||
|
||||
}
|
||||
} else {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => '저장데이터 누락',
|
||||
]);
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 파일업로드(평면도)
|
||||
public function uploadFile()
|
||||
{
|
||||
$lib = new MyUpload();
|
||||
|
||||
try {
|
||||
|
||||
$rcpt_no = $this->request->getPost('rcpt_no');
|
||||
$files = $this->request->getFiles();
|
||||
$uploadPath = "/upload/apt_file/" . $rcpt_no . "/";
|
||||
|
||||
|
||||
if (!isset($rcpt_no)) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'msg' => '접수번호 누락'
|
||||
]);
|
||||
}
|
||||
|
||||
if (!isset($files['file'])) {
|
||||
return $this->response->setJSON([
|
||||
'success' => false,
|
||||
'msg' => '파일 없음'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$arrUploadfile = [];
|
||||
$file = $files['file'];
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||
|
||||
if ($uploadData !== false) {
|
||||
$arrUploadfile[] = $uploadData;
|
||||
}
|
||||
}
|
||||
|
||||
$gps_lat = null;
|
||||
$gps_lon = null;
|
||||
$camDate = null;
|
||||
// print_r($arrUploadfile);
|
||||
// exit;
|
||||
if (!empty($arrUploadfile)) {
|
||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||
$object_storage_url = $uploadFile['object_storage_url'];
|
||||
$arrExifData = @exif_read_data($object_storage_url);
|
||||
if (!empty($arrExifData)) {
|
||||
$notFound = "Unavailable";
|
||||
if (@array_key_exists('DateTime', $arrExifData)) {
|
||||
$camDate = $arrExifData['DateTime'];
|
||||
} else {
|
||||
$camDate = $notFound;
|
||||
}
|
||||
|
||||
$imageMetaData = $camDate;
|
||||
$camDate = substr(str_replace(':', '-', $camDate), 0, 10);
|
||||
|
||||
$arrGPS = $arrExifData['GPS'] ?? null;
|
||||
|
||||
if (empty($arrGPS)) { // GPS 섹션이 없으면, 개별 키로도 체크
|
||||
if (!empty($arrExifData['GPSLongitude']) && !empty($arrExifData['GPSLatitude'])) {
|
||||
$arrGPS = [
|
||||
'GPSLongitude' => $arrExifData['GPSLongitude'],
|
||||
'GPSLatitude' => $arrExifData['GPSLatitude'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!empty($arrGPS)
|
||||
&& !empty($arrGPS['GPSLongitude'])
|
||||
&& !empty($arrGPS['GPSLatitude'])
|
||||
&& is_array($arrGPS['GPSLongitude'])
|
||||
&& is_array($arrGPS['GPSLatitude'])
|
||||
) { //GPS 정보가 있다면
|
||||
if (@array_key_exists('GPSLongitude', $arrGPS) && (@array_key_exists('GPSLatitude', $arrGPS))) {
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLatitude"][0], "%d/%d"); //문자->숫자로 계산
|
||||
$gps_lat_d = $temp_d1 / $temp_d2;
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLatitude"][1], "%d/%d");
|
||||
$gps_lat_m = $temp_d1 / $temp_d2;
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLatitude"][2], "%d/%d");
|
||||
$gps_lat_s = $temp_d1 / $temp_d2;
|
||||
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLongitude"][0], "%d/%d"); //문자->숫자로 계산
|
||||
$gps_lon_d = $temp_d1 / $temp_d2;
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLongitude"][1], "%d/%d");
|
||||
$gps_lon_m = $temp_d1 / $temp_d2;
|
||||
list($temp_d1, $temp_d2) = sscanf($arrGPS["GPSLongitude"][2], "%d/%d");
|
||||
$gps_lon_s = $temp_d1 / $temp_d2;
|
||||
|
||||
$gps_lat = $gps_lat_d + $gps_lat_m / 60 + $gps_lat_s / 3600; //도분초를 도로 변환
|
||||
$gps_lon = $gps_lon_d + $gps_lon_m / 60 + $gps_lon_s / 3600;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$base = $uploadFile['base_name']; // xxxx
|
||||
$dir = rtrim(dirname($uploadFile['object_key']), '/'); // upload/apt_file/2
|
||||
$thumbKey = $dir . '/' . $base . '_thumb.jpg';
|
||||
|
||||
$imageDataBlob = file_get_contents($object_storage_url);
|
||||
$im = new \Imagick();
|
||||
$im->readImageBlob($imageDataBlob);
|
||||
$im->thumbnailImage(105, 80, false);
|
||||
$thumb_im = $im->getImageBlob();
|
||||
// 썸네일 s3 전송
|
||||
$lib->upload_object_storage_imagick2($thumbKey, $thumb_im);
|
||||
|
||||
|
||||
/**
|
||||
* 파일업로드 내용 저장
|
||||
* rcpt_no, pho_lati, pho_long, filenm, filenm_up, file_path, thumb_path, thumb_nm, cloud_upload_yn
|
||||
*
|
||||
*/
|
||||
$uploadParam = [
|
||||
'rcpt_no' => $rcpt_no, // 접수번호
|
||||
'gps_lat' => $gps_lat, // latitude
|
||||
'gps_lon' => $gps_lon, // longitude
|
||||
'origin_name' => $uploadFile['origin_name'], // 원본파일명
|
||||
'file_name' => $uploadFile['file_name'], // 저장파일명
|
||||
'file_ext' => '.' . $uploadFile['ext'], // 파일확장자
|
||||
'upload_path' => $uploadPath, // 저장경로
|
||||
'thumb_name' => $base . '_thumb.jpg',
|
||||
'cam_date' => $camDate, // 촬영일
|
||||
];
|
||||
|
||||
// INSERT INTO apt_ground_photo
|
||||
$res = $this->model->saveImg($uploadParam);
|
||||
log_message('debug', 'apt_ground_file :: rcpt_no : ' . $rcpt_no . ', fileName : ' . $uploadFile['file_name']);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $this->response->setJSON([
|
||||
'code' => '0',
|
||||
'msg' => 'success'
|
||||
]);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return $this->response->setJSON([
|
||||
'code' => '9',
|
||||
'msg' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user