변경 파일 목록
총 15개
Component (7)
AdminLogDAO.phpAdmin/BankdaGhostDepositor.phpBankda/ExcelOrderConvert.phpExcel/ExcelRequest.phpExcel/OrderAdminNew.phpOrder/OrderAdmin.phpOrder/RegularOrderAdminListExcel.phpRegularDelivery/RegularOrderAdmin/Controller (8)
BankdaMatchPsController.phpAdmin/Order/BankdaNoMatchPsController.phpAdmin/Order/CashReceiptPsController.phpAdmin/Order/EpostReturnRequestController.phpAdmin/Order/EpostReturnRequestPsController.phpAdmin/Order/OrderPsController.phpAdmin/Order/PostPsController.phpAdmin/Order/LayerExcelPsController.phpAdmin/Share/변경 파일 코드
추가삭제
변경 전AdminLogDAO.php
| use Framework\Utility\DateTimeUtils; | |
| use Framework\Utility\StringUtils; | |
| use Origin\Enum\Policy\AccessLogAction; | |
| use Component\Member\MemberMasking; | |
| use Origin\Service\Member\ManagerEditPolicy; | |
| * @return array | |
| */ | |
| public function setDisplayAdminLogList($data){ | |
| foreach ($data as $lKey => $lVal) { | |
| $data[$lKey]['displayDetailLogFl'] = 'n'; | |
| $fileName = end(explode('/', $lVal['baseUri'])); | |
| // 회원정보 조회를 할 경우에만 상세로그 노출 | |
| switch ($fileName) { | |
| */ | |
| public function setDisplayAdminLogInfo($data) | |
| { | |
| $fileUri = explode('/', $data['baseUri']); | |
| $fileName = end($fileUri); | |
| $result['searchCnt'] = $data['data']['searchCnt']; | |
| $result['searchData'] = $data['data']['searchData']; | |
| $result['key'] = $data['data']['GET']['key']; | |
| $result['keyword'] = $data['data']['GET']['keyword']; | |
| $result['viewCnt'] = gd_count(explode(',', $data['data']['searchData'])); | |
| if ($data['data']['searchCnt'] > 1) { | |
| if ($result['viewCnt'] > 1) { | |
| $searchData = $data['data']['searchData']; | |
| } else { | |
| if (empty($data['data']['POST']['excelDownloadReason']) === false) { | |
| $result['downloadReason'] = '사유 : ' . $data['data']['POST']['excelDownloadReason']; | |
| } | |
| if (empty($data['data']['POST']['totalCount']) === false) { | |
| $result['searchTargetMsg'] .= '<br>처리건수 : ' . number_format($data['data']['POST']['totalCount']) . '건'; | |
| } | |
| break; | |
| case 'crema_ps.php': | |
| if (empty($searchCondition) == false && $searchConditionMsgView === true) { | |
| $result['searchConditionMsg'] = '처리조건 : ' . $searchCondition; | |
| } | |
| if (empty($searchViewCnt) == false && $searchViewCntView === true) { | |
| $result['searchViewCnt'] = '처리건수 : ' . $searchViewCnt . '건'; | |
| } | |
| if ($searchTarget != '') { | |
| private function getActionName($pageData) | |
| { | |
| return $this->getValue('action', $pageData, '조회'); | |
| } | |
| private function getMenuName($menu) | |
변경 후AdminLogDAO.php
| use Framework\Utility\DateTimeUtils; | |
| use Framework\Utility\StringUtils; | |
| use Origin\Enum\Policy\AccessLogAction; | |
| use Origin\Enum\Admin\AdminLogAction; | |
| use Framework\Log\PrivacyLog\PrivacyLogResolverRegistry; | |
| use Component\Member\MemberMasking; | |
| use Origin\Service\Member\ManagerEditPolicy; | |
| * @return array | |
| */ | |
| public function setDisplayAdminLogList($data){ | |
| $registry = App::getInstance(PrivacyLogResolverRegistry::class); | |
| foreach ($data as $lKey => $lVal) { | |
| $data[$lKey]['displayDetailLogFl'] = 'n'; | |
| // 개인정보접속기록 엑셀 다운로드 내역처럼 baseUri 없이 조회한 목록도 있다 | |
| $baseUri = (string) ($lVal['baseUri'] ?? ''); | |
| $logData = is_string($lVal['data'] ?? null) ? (json_decode($lVal['data'], true) ?: []) : []; | |
| if ($registry->findDisplayResolver($baseUri, $logData) !== null) { | |
| $data[$lKey]['displayDetailLogFl'] = 'y'; | |
| continue; | |
| } | |
| $fileName = basename($baseUri); | |
| // 회원정보 조회를 할 경우에만 상세로그 노출 | |
| switch ($fileName) { | |
| */ | |
| public function setDisplayAdminLogInfo($data) | |
| { | |
| $registry = App::getInstance(PrivacyLogResolverRegistry::class); | |
| $resolver = $registry->findDisplayResolver($data['baseUri']); | |
| if ($resolver !== null) { | |
| $result = $resolver->getDisplayData($data['baseUri'], $data['data']); | |
| $result['searchCnt'] = $data['data']['searchCnt'] ?? null; | |
| $result['searchData'] = htmlspecialchars($result['searchData'], ENT_QUOTES, 'UTF-8'); | |
| $result['searchConditionMsg'] = '처리조건 : ' . htmlspecialchars($result['keyValue'], ENT_QUOTES, 'UTF-8'); | |
| if ($result['keyword'] !== '') { | |
| $result['searchConditionMsg'] .= ' (' . htmlspecialchars($result['keyword'], ENT_QUOTES, 'UTF-8') . ')'; | |
| } | |
| $result['searchViewCnt'] = '처리건수 : ' . $result['viewCnt'] . '건'; | |
| $contents = [$result['searchConditionMsg'], $result['searchViewCnt']]; | |
| if ($result['searchData'] !== '') { | |
| $result['searchTargetMsg'] = '처리대상 : ' . $result['searchData']; | |
| $contents[] = $result['searchTargetMsg']; | |
| } | |
| $result['logContents'] = implode('<br />', $contents); | |
| return $result; | |
| } | |
| $data['data']['searchData'] = $data['data']['searchData'] ?? ''; | |
| $fileUri = explode('/', $data['baseUri']); | |
| $fileName = end($fileUri); | |
| $result['searchCnt'] = $data['data']['searchCnt']; | |
| $result['searchData'] = $data['data']['searchData']; | |
| $result['key'] = $data['data']['GET']['key']; | |
| $result['keyword'] = $data['data']['GET']['keyword']; | |
| $result['viewCnt'] = empty($data['data']['searchData']) ? 0 : count(explode(',', $data['data']['searchData'])); | |
| if ($result['viewCnt'] === 0) { | |
| $searchData = ''; | |
| } elseif ($data['data']['searchCnt'] > 1) { | |
| if ($result['viewCnt'] > 1) { | |
| $searchData = $data['data']['searchData']; | |
| } else { | |
| if (empty($data['data']['POST']['excelDownloadReason']) === false) { | |
| $result['downloadReason'] = '사유 : ' . $data['data']['POST']['excelDownloadReason']; | |
| } | |
| $totalCount = $data['data']['POST']['totalCount'] ?? null; | |
| if ($totalCount !== null && $totalCount !== '') { | |
| $result['searchTargetMsg'] .= '<br>처리건수 : ' . number_format($totalCount) . '건'; | |
| } | |
| break; | |
| case 'crema_ps.php': | |
| if (empty($searchCondition) == false && $searchConditionMsgView === true) { | |
| $result['searchConditionMsg'] = '처리조건 : ' . $searchCondition; | |
| } | |
| if ($searchViewCntView) { | |
| $result['searchViewCnt'] = '처리건수 : ' . $searchViewCnt . '건'; | |
| } | |
| if ($searchTarget != '') { | |
| private function getActionName($pageData) | |
| { | |
| return $this->getValue('action', $pageData, AdminLogAction::VIEW); | |
| } | |
| private function getMenuName($menu) | |
변경 전BankdaGhostDepositor.php
| /** | |
| * 미확인 입금자 디비 저장 | |
| * @param array $arrData 미확인 입금자 배열 | |
| */ | |
| public function registerGhostDepositor($arrData) { | |
| $insertData['depositPrice'] = isset($arrData['depositPrice']) ? $arrData['depositPrice'] : ''; | |
| $arrBind = $this->db->get_binding(DBTableField::tableGhostDepositor(), $insertData, 'insert'); | |
| $this->db->set_insert_db(DB_GHOST_DEPOSITOR, $arrBind['param'], $arrBind['bind'], 'y'); | |
| } | |
| /** | |
변경 후BankdaGhostDepositor.php
| /** | |
| * 미확인 입금자 디비 저장 | |
| * @param array $arrData 미확인 입금자 배열 | |
| * @return int|string 등록된 미확인 입금자 번호 | |
| */ | |
| public function registerGhostDepositor($arrData) { | |
| $insertData['depositPrice'] = isset($arrData['depositPrice']) ? $arrData['depositPrice'] : ''; | |
| $arrBind = $this->db->get_binding(DBTableField::tableGhostDepositor(), $insertData, 'insert'); | |
| $this->db->set_insert_db(DB_GHOST_DEPOSITOR, $arrBind['param'], $arrBind['bind'], 'y'); | |
| return $this->db->insert_id(); | |
| } | |
| /** | |
변경 전ExcelOrderConvert.php
| 'fail' => $failCnt, | |
| 'functionAuth' => $functionAuthCnt, | |
| 'message' => $failMessage, | |
| ]; | |
| } | |
변경 후ExcelOrderConvert.php
| 'fail' => $failCnt, | |
| 'functionAuth' => $functionAuthCnt, | |
| 'message' => $failMessage, | |
| 'groupCd' => $groupCd, | |
| ]; | |
| } | |
변경 전ExcelRequest.php
| */ | |
| } | |
| public function makeExcelFile(&$arrData) | |
| { | |
| $excleForm = \App::load('\\Component\\Excel\\ExcelForm'); | |
| $this->fileConfig['menu'] = $formData['menu']; | |
| $this->fileConfig['location'] = $formData['location']; | |
| if (!is_dir(UserFilePath::data('excel', $formData['menu'])->getPathName())) { | |
| mkdir(UserFilePath::data('excel', $formData['menu'])->getPathName(), 0707); | |
| } | |
| $regularOrderAdmin = \App::getInstance(\Component\RegularDelivery\RegularOrderAdmin\RegularOrderAdminListExcel::class); | |
| $rows = $regularOrderAdmin->generateExcelForm(unserialize($arrData['whereCondition']), $formData['excelField'], $defaultField); | |
| $getData = $this->getRegularOrderList($rows); | |
| } else { | |
| $getData = $this->getOrderList(unserialize($arrData['whereCondition']), $formData['excelField'], $defaultField, $excelFieldName); | |
| } | |
| $tmpGetData = $this->getMemberMemberList(unserialize($arrData['whereCondition']), $formData['excelField'], $excelFieldName); | |
| } | |
| $getData = $tmpGetData['getData']; | |
| $arrData['totalCount'] = $tmpGetData['totalCount']; | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_manage') { | |
| $getData = $this->getPromotionCouponManage($arrData, $formData['excelField'], $excelFieldName); | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_offline_manage') { | |
| } | |
| if ($getData) { | |
| if (\is_array($getData)) { | |
| foreach ($getData as $k => $v) { | |
| $this->genarateFile($v); | |
| } | |
| } else { | |
| if (gd_isset($this->fileConfig['password'])) { | |
| $arrData['filePath'] = "excel" . DS . $formData['menu']; | |
| $arrData['fileName'] = gd_implode(STR_DIVISION, $this->fileConfig['fileName']); | |
| $arrData['state'] = "y"; | |
| $arrData['expiryDate'] = date("Y-m-d", strtotime("+7 day")); | |
| $setData = $setHedData = []; | |
| $setHedData[] = '<tr>'; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $orderData = $orderAdmin->getOrderListForAdminExcel($whereCondition, $whereCondition['periodFl'], $isUserHandle, $orderType, $excelField, 0, $this->excelPageNum); | |
| //튜닝한 업체를 위해 데이터 맞춤 | |
| if (empty($orderData['totalCount']) === true && empty($orderData['orderList']) === true) { | |
| $isGenerator = false; | |
| $totalNum = gd_count($orderData); | |
| if ($this->excelPageNum) $orderList = array_chunk($orderData, $this->excelPageNum, true); | |
| $totalNum = gd_count($orderData['totalCount']); | |
| $orderList = $orderData['orderList']; | |
| if (gd_is_provider() && $orderType == 'goods') { | |
| $totalScmInfo = $orderData['totalScmInfo']; | |
| } | |
| } | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| $maskLabels = is_array($data) === true ? $excelMasking->resolveOrderLabels($data) : null; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum == 1) ? 100 : round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))); | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } else { | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| } | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| } | |
| $totalNum = gd_count($data); | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| foreach ($data as $k => $v) { | |
| // 분리보관(탈퇴/휴면) 주문 판정을 페이지 단위로 1회만 조회한다 | |
| $maskLabels = $excelMasking->resolveOrderLabels($v); | |
| $totalNum = gd_count($data); | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| foreach ($data as $k => $v) { | |
| // 분리보관(탈퇴/휴면) 주문 판정을 페이지 단위로 1회만 조회한다 | |
| $maskLabels = $excelMasking->resolveOrderLabels($v); | |
| $orderList = $orderData['orderList']; | |
| } | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| $maskLabels = is_array($data) === true ? $excelMasking->resolveOrderLabels($data) : null; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum - 1) > 0 ? round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))) : 100; | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| } | |
| return true; | |
| $setData = []; | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $setData[] = gd_array_merge($setHedData, $tmpData); | |
| } | |
| return ['getData' => $setData, 'totalCount' => '$totalNum']; | |
| } | |
| } | |
변경 후ExcelRequest.php
| */ | |
| } | |
| /** | |
| * @param array $fileInfo 엑셀 요청의 menu, fileName, whereCondition, totalCount | |
| * @param int|string $excelKey 선택한 파일 순번 | |
| * @return int|string|null 파일별 처리건수 또는 미집계 | |
| */ | |
| public function getDownloadTotalCount(array $fileInfo, $excelKey) | |
| { | |
| if (!in_array($fileInfo['menu'] ?? '', ['order', 'orderDraft', 'member'], true)) { | |
| return $fileInfo['totalCount'] ?? null; | |
| } | |
| $fileNames = explode(STR_DIVISION, $fileInfo['fileName'] ?? ''); | |
| if ((!is_int($excelKey) && !is_string($excelKey)) | |
| || (string) (int) $excelKey !== (string) $excelKey | |
| || !isset($fileNames[$excelKey]) | |
| || empty($fileNames[$excelKey])) { | |
| return null; | |
| } | |
| $whereCondition = []; | |
| if (!empty($fileInfo['whereCondition'])) { | |
| if (!is_string($fileInfo['whereCondition'])) { | |
| return null; | |
| } | |
| $whereCondition = @unserialize($fileInfo['whereCondition'], ['allowed_classes' => false]); | |
| if (!is_array($whereCondition)) { | |
| return null; | |
| } | |
| } | |
| if (array_key_exists('excelFileCounts', $whereCondition)) { | |
| $fileCounts = $whereCondition['excelFileCounts']; | |
| if (!is_array($fileCounts) || array_keys($fileCounts) !== $fileNames) { | |
| return null; | |
| } | |
| foreach ($fileCounts as $fileCount) { | |
| if (!is_int($fileCount) || $fileCount < 0) { | |
| return null; | |
| } | |
| } | |
| return $fileCounts[$fileNames[$excelKey]]; | |
| } | |
| // 파일별 집계가 없는 이전 요청과 튜닝 사본은 기존 건수 표시를 유지한다. | |
| return $fileInfo['totalCount'] ?? null; | |
| } | |
| public function makeExcelFile(&$arrData) | |
| { | |
| $excleForm = \App::load('\\Component\\Excel\\ExcelForm'); | |
| $this->fileConfig['menu'] = $formData['menu']; | |
| $this->fileConfig['location'] = $formData['location']; | |
| // 미집계와 실제 0건을 구분하고 재사용 시 직전 요청 값을 제거한다. | |
| $this->fileConfig['totalCount'] = null; | |
| $this->fileConfig['excelFileCounts'] = []; | |
| $tracksFileCount = in_array($formData['menu'], ['order', 'member'], true) || $arrData['menu'] === 'orderDraft'; | |
| if ($tracksFileCount) { | |
| $this->fileConfig['fileName'] = []; | |
| $logWhereCondition = unserialize($arrData['whereCondition'], ['allowed_classes' => false]); | |
| if (is_array($logWhereCondition)) { | |
| // 요청에서 전달되거나 이전 생성 때 저장한 건수는 재집계한다. | |
| unset($logWhereCondition['excelFileCounts']); | |
| $arrData['whereCondition'] = serialize($logWhereCondition); | |
| } | |
| } | |
| if (!is_dir(UserFilePath::data('excel', $formData['menu'])->getPathName())) { | |
| mkdir(UserFilePath::data('excel', $formData['menu'])->getPathName(), 0707); | |
| } | |
| $regularOrderAdmin = \App::getInstance(\Component\RegularDelivery\RegularOrderAdmin\RegularOrderAdminListExcel::class); | |
| $rows = $regularOrderAdmin->generateExcelForm(unserialize($arrData['whereCondition']), $formData['excelField'], $defaultField); | |
| $getData = $this->getRegularOrderList($rows); | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 (상속 없이 복사된 튜닝 사본에는 신규 메소드가 없어 방어) | |
| $this->fileConfig['totalCount'] = method_exists($regularOrderAdmin, 'getTotalCount') | |
| ? $regularOrderAdmin->getTotalCount() | |
| : null; | |
| } else { | |
| $getData = $this->getOrderList(unserialize($arrData['whereCondition']), $formData['excelField'], $defaultField, $excelFieldName); | |
| } | |
| $tmpGetData = $this->getMemberMemberList(unserialize($arrData['whereCondition']), $formData['excelField'], $excelFieldName); | |
| } | |
| $getData = $tmpGetData['getData']; | |
| $this->fileConfig['totalCount'] = $tmpGetData['totalCount']; | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_manage') { | |
| $getData = $this->getPromotionCouponManage($arrData, $formData['excelField'], $excelFieldName); | |
| } else if ($formData['menu'] == 'promotion' && $formData['location'] == 'coupon_offline_manage') { | |
| } | |
| if ($getData) { | |
| $generatedAllFiles = true; | |
| if (\is_array($getData)) { | |
| foreach ($getData as $k => $v) { | |
| if ($this->genarateFile($v) === false) { | |
| $generatedAllFiles = false; | |
| } | |
| } | |
| } else { | |
| if (gd_isset($this->fileConfig['password'])) { | |
| $arrData['filePath'] = "excel" . DS . $formData['menu']; | |
| $arrData['fileName'] = gd_implode(STR_DIVISION, $this->fileConfig['fileName']); | |
| if ($tracksFileCount) { | |
| $fileNames = $this->fileConfig['fileName']; | |
| $fileCounts = $this->fileConfig['excelFileCounts']; | |
| if (empty($fileCounts) && count($fileNames) === 1 && isset($this->fileConfig['totalCount'])) { | |
| $fileCounts = [(int) $this->fileConfig['totalCount']]; | |
| } | |
| $logWhereCondition = unserialize($arrData['whereCondition'], ['allowed_classes' => false]); | |
| $logWhereCondition = is_array($logWhereCondition) ? $logWhereCondition : []; | |
| $logWhereCondition['excelFileCounts'] = []; | |
| if ($generatedAllFiles | |
| && (!is_array($getData) || count($getData) === count($fileNames)) | |
| && !empty($fileNames) | |
| && count($fileNames) === count(array_unique($fileNames)) | |
| && empty($fileCounts)) { | |
| unset($logWhereCondition['excelFileCounts']); | |
| } | |
| if ($generatedAllFiles | |
| && (!is_array($getData) || count($getData) === count($fileNames)) | |
| && !empty($fileNames) | |
| && count($fileNames) === count(array_unique($fileNames)) | |
| && count($fileNames) === count($fileCounts) | |
| && array_keys($fileCounts) === range(0, count($fileNames) - 1)) { | |
| $logWhereCondition['excelFileCounts'] = array_combine($fileNames, $fileCounts); | |
| } | |
| $arrData['whereCondition'] = serialize($logWhereCondition); | |
| } | |
| if (isset($this->fileConfig['totalCount'])) { | |
| // DBTool의 느슨한 null 비교에서 정수 0이 기본값으로 바뀌므로 문자열로 전달한다. | |
| $arrData['totalCount'] = $this->fileConfig['totalCount'] === 0 ? '0' : $this->fileConfig['totalCount']; | |
| } | |
| $arrData['state'] = "y"; | |
| $arrData['expiryDate'] = date("Y-m-d", strtotime("+7 day")); | |
| $setData = $setHedData = []; | |
| $setHedData[] = '<tr>'; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $orderData = $orderAdmin->getOrderListForAdminExcel($whereCondition, $whereCondition['periodFl'], $isUserHandle, $orderType, $excelField, 0, $this->excelPageNum); | |
| //튜닝한 업체를 위해 데이터 맞춤 | |
| if (!isset($orderData['totalCount'], $orderData['orderList'])) { | |
| $isGenerator = false; | |
| $totalNum = gd_count($orderData); | |
| if ($this->excelPageNum) $orderList = array_chunk($orderData, $this->excelPageNum, true); | |
| $totalNum = gd_count($orderData['totalCount']); | |
| $orderList = $orderData['orderList']; | |
| if (gd_is_provider() && $orderType == 'goods') { | |
| $totalScmInfo = $orderData['totalScmInfo'] ?? []; | |
| } | |
| } | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| $maskLabels = is_array($data) === true ? $excelMasking->resolveOrderLabels($data) : null; | |
| $fileCount = 0; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum == 1) ? 100 : round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))); | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } else { | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| } | |
| $fileCount++; | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| $this->fileConfig['excelFileCounts'][] = $fileCount; | |
| } | |
| $totalNum = gd_count($data); | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| // 분리보관(탈퇴/휴면) 주문 판정을 페이지 단위로 1회만 조회한다 | |
| $maskLabels = $excelMasking->resolveOrderLabels($v); | |
| $totalNum = gd_count($data); | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| if ($this->excelPageNum) $data = array_chunk($data, $this->excelPageNum, true); | |
| else $data = array_chunk($data, $totalNum, true); | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| // 분리보관(탈퇴/휴면) 주문 판정을 페이지 단위로 1회만 조회한다 | |
| $maskLabels = $excelMasking->resolveOrderLabels($v); | |
| $orderList = $orderData['orderList']; | |
| } | |
| // 개인정보 접속기록의 '처리건수' 로 남길 실제 산출 건수 | |
| $this->fileConfig['totalCount'] = $totalNum; | |
| //값이 입력되지 않은 것으로 간주하고 전체 다운로드. | |
| if ($this->excelPageNum == 0) { | |
| $pageNum = 0; | |
| $excelMasking = \App::getInstance(OrderExcelMaskingService::class); | |
| $maskLabels = is_array($data) === true ? $excelMasking->resolveOrderLabels($data) : null; | |
| $fileCount = 0; | |
| foreach ($data as $key => $val) { | |
| $progress = ($totalNum - 1) > 0 ? round((100 / ($totalNum - 1)) * ($key + ($i * $this->excelPageNum))) : 100; | |
| if ($progress % 20 == 0 || $progress == '100') { | |
| } | |
| fwrite($fh, gd_implode(chr(10), $tmpData)); | |
| $fileCount++; | |
| unset($tmpData); | |
| } | |
| fclose($fh); | |
| $this->fileConfig['fileName'][] = $fileName . ".xls"; | |
| $this->fileConfig['excelFileCounts'][] = $fileCount; | |
| } | |
| return true; | |
| $setData = []; | |
| $setHedData[] = "<tr>"; | |
| foreach ($data as $k => $v) { | |
| $this->fileConfig['excelFileCounts'][] = count($v); | |
| $tmpData = []; | |
| foreach ($v as $key => $val) { | |
| if (($key % 20 == 0 && $key != '0') || $totalNum - 1 == $key) { | |
| $setData[] = gd_array_merge($setHedData, $tmpData); | |
| } | |
| return ['getData' => $setData, 'totalCount' => $totalNum]; | |
| } | |
| } | |
변경 전OrderAdminNew.php
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| } | |
변경 후OrderAdminNew.php
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| /** @var array 우체국택배 송장번호를 발급한 주문번호 (saveOrderInvoice) */ | |
| protected $issuedInvoiceOrderNos = []; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| $this->issuedInvoiceOrderNos = []; | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| $this->issuedInvoiceOrderNos[] = $v['orderNo']; | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @return array 예약된 주문번호 목록 | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| $reservedOrderNos = []; | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| $reservedOrderNos[] = $updateData[$v]['orderNo']; | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| return array_values(array_unique($reservedOrderNos)); | |
| } | |
| /** | |
| * 우체국택배 송장번호를 발급한 주문번호 — 직전 saveOrderInvoice 호출 기준 | |
| * | |
| * @return array | |
| */ | |
| public function getIssuedInvoiceOrderNos() | |
| { | |
| return array_values(array_unique($this->issuedInvoiceOrderNos)); | |
| } | |
변경 전OrderAdmin.php
| protected $cancelOrderlLimit = 500; | |
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| } | |
변경 후OrderAdmin.php
| protected $cancelOrderlLimit = 500; | |
| /** @var array 현재 자동취소 주문건 */ | |
| protected $targetOrderGoodsNoArr; | |
| /** @var array 우체국택배 송장번호를 발급한 주문번호 (saveOrderInvoice) */ | |
| protected $issuedInvoiceOrderNos = []; | |
| protected $targetOrderGoodsNo; | |
| public $userHandleText = [ | |
| */ | |
| public function saveOrderInvoice($arrData, $searchPeriod = '7') | |
| { | |
| $this->issuedInvoiceOrderNos = []; | |
| parse_str($arrData['whereDetail'], $arrData['whereDetail']); | |
| $arrData['whereDetail']['statusMode'] = "p,g"; | |
| } | |
| $this->db->set_insert_db(DB_ORDER_GODO_POST, 'invoiceNo', array('s', $invoiceNo,), 'y'); | |
| $this->issuedInvoiceOrderNos[] = $v['orderNo']; | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| * | |
| * @param $arrData | |
| * | |
| * @return array 예약된 주문번호 목록 | |
| * @throws Exception | |
| * @internal param string $getValue 파라미터 | |
| */ | |
| } | |
| $resultData = $godoPost->sendInvoiceInfo($setData); | |
| $reservedOrderNos = []; | |
| if ($resultData) { | |
| $this->db->set_update_db(DB_ORDER_GODO_POST, $arrUpdate, 'invoiceNo = ?', $arrBind); | |
| unset($arrUpdate); | |
| unset($arrBind); | |
| $reservedOrderNos[] = $updateData[$v]['orderNo']; | |
| //예약완료시 입금상태의 주문건일 경우 상품준비중으로 변경 | |
| } else { | |
| throw new \Exception(__('우체국 택배 연동하기가 실패하였습니다.')); | |
| } | |
| return array_values(array_unique($reservedOrderNos)); | |
| } | |
| /** | |
| * 우체국택배 송장번호를 발급한 주문번호 — 직전 saveOrderInvoice 호출 기준 | |
| * | |
| * @return array | |
| */ | |
| public function getIssuedInvoiceOrderNos() | |
| { | |
| return array_values(array_unique($this->issuedInvoiceOrderNos)); | |
| } | |
변경 전RegularOrderAdminListExcel.php
| * @var Logger | |
| */ | |
| private $logger; | |
| /** | |
| * @var OrderExcelMaskingService | |
| } | |
| $this->logger->channel('regularOrderAdmin')->info('정기결제 엑셀 폼 데이터 : ', $regularOrderExcelList); | |
| // 엑셀 헤더 설정 | |
| $headers = []; | |
| return array_merge($headers, $rows); | |
| } | |
| } | |
변경 후RegularOrderAdminListExcel.php
| * @var Logger | |
| */ | |
| private $logger; | |
| /** | |
| * 엑셀에 담긴 실제 건수 (개인정보 접속기록의 '처리건수') | |
| * | |
| * @var int|null | |
| */ | |
| protected $totalCount = null; | |
| /** | |
| * @var OrderExcelMaskingService | |
| } | |
| $this->logger->channel('regularOrderAdmin')->info('정기결제 엑셀 폼 데이터 : ', $regularOrderExcelList); | |
| $this->totalCount = count($regularOrderExcelList); | |
| // 엑셀 헤더 설정 | |
| $headers = []; | |
| return array_merge($headers, $rows); | |
| } | |
| /** | |
| * generateExcelForm() 이후에만 값이 있고, 그 전에는 null | |
| * | |
| * @return int|null | |
| */ | |
| public function getTotalCount(): ?int | |
| { | |
| return $this->totalCount; | |
| } | |
| } | |
변경 전BankdaMatchPsController.php
| case 'accountList': | |
| $bk = new Bankda(); | |
| $res = $bk->accountList(Request::get()->toArray()); | |
| echo $res; | |
| exit(); | |
| break; | |
| try { | |
| $bk = new Bankda(); | |
| $res = $bk->bankMatching(Request::get()->toArray()); | |
| echo $res; | |
| exit(); | |
| } catch (\Exception $e) { | |
| $bk = new Bankda(); | |
| $getValue = Request::get()->toArray(); | |
| $res = $bk->bankManualOrderList($getValue); | |
| if($res) { | |
| echo json_encode($res, JSON_UNESCAPED_UNICODE); | |
| } | |
| throw new HttpException($e->ectMessage, 500); | |
| } | |
| } | |
| } | |
변경 후BankdaMatchPsController.php
| case 'accountList': | |
| $bk = new Bankda(); | |
| $res = $bk->accountList(Request::get()->toArray()); | |
| $accountList = json_decode($res, true); | |
| $this->attachPrivacyLogResult( | |
| $this->extractListTargets($accountList, 'bkcode'), | |
| $this->extractListTotalCount($accountList) | |
| ); | |
| echo $res; | |
| exit(); | |
| break; | |
| try { | |
| $bk = new Bankda(); | |
| $res = $bk->bankMatching(Request::get()->toArray()); | |
| $this->attachPrivacyLogResult($this->extractMatchedOrderNos($res)); | |
| echo $res; | |
| exit(); | |
| } catch (\Exception $e) { | |
| $bk = new Bankda(); | |
| $getValue = Request::get()->toArray(); | |
| $res = $bk->bankManualOrderList($getValue); | |
| $this->attachPrivacyLogResult($this->extractListTargets($res, 'orderNo'), $this->extractListTotalCount($res)); | |
| if($res) { | |
| echo json_encode($res, JSON_UNESCAPED_UNICODE); | |
| } | |
| throw new HttpException($e->ectMessage, 500); | |
| } | |
| } | |
| /** | |
| * 조회 결과 행의 식별자 — 결과 검증에서 누락을 감지하도록 응답과 식별자의 null 을 보존한다 | |
| * | |
| * 통장입금내역은 입금내역 코드(뱅크다 TBLBANK.bkcode), 입금대기 주문은 주문번호를 처리대상으로 남긴다. | |
| * 입금대기 주문은 결과가 없으면 lists 없이 page 만 내려준다 | |
| * | |
| * @param mixed $response 조회 응답 (lists: 조회 행 목록, page: 페이징 정보) | |
| * @param string $field 행의 식별자 필드 (bkcode, orderNo) | |
| * @return array|null 응답 형식이 아니면 null | |
| */ | |
| protected function extractListTargets(mixed $response, string $field): ?array | |
| { | |
| if (!is_array($response) || !is_array($response['page'] ?? null)) { | |
| return null; | |
| } | |
| $lists = $response['lists'] ?? []; | |
| return is_array($lists) | |
| ? array_map(static fn(mixed $row): mixed => is_array($row) ? ($row[$field] ?? null) : null, $lists) | |
| : null; | |
| } | |
| /** | |
| * 조회 결과의 검색 건수 | |
| * | |
| * @param mixed $response 조회 응답 (page.recode: 검색 건수) | |
| * @return int|null | |
| */ | |
| protected function extractListTotalCount(mixed $response): ?int | |
| { | |
| $totalCount = is_array($response) ? ($response['page']['recode'] ?? null) : null; | |
| return is_numeric($totalCount) ? (int) $totalCount : null; | |
| } | |
| /** | |
| * 실시간입금확인으로 입금확인된 주문번호 — 화면 결과 레이어와 같이 '^' 뒤를 '|' 로 나눈다 | |
| * | |
| * @param mixed $result 매칭 결과 (결과 메시지^주문번호|주문번호) | |
| * @return array|null 입금확인된 주문이 없으면 빈 배열 | |
| */ | |
| protected function extractMatchedOrderNos(mixed $result): ?array | |
| { | |
| if (!is_string($result)) { | |
| return null; | |
| } | |
| $orderNos = explode('^', $result, 2)[1] ?? ''; | |
| return $orderNos === '' ? [] : explode('|', $orderNos); | |
| } | |
| } | |
변경 전BankdaNoMatchPsController.php
| // --- 미확인 입금자 등록 | |
| case 'insert': | |
| $ghostDepositor->registerGhostDepositor($requestPostParams); | |
| $rs['result'] = true; | |
| $this->json($rs); | |
| case 'load': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $this->json($res); | |
| break; | |
| case 'download': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $ghostDepositor->downloadGhostDepositor($res['body']); | |
| default: | |
| exit; | |
| } | |
| } | |
변경 후BankdaNoMatchPsController.php
| // --- 미확인 입금자 등록 | |
| case 'insert': | |
| $sno = $ghostDepositor->registerGhostDepositor($requestPostParams); | |
| // 등록 번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (!empty($sno)) { | |
| $this->attachPrivacyLogResult([$sno]); | |
| } | |
| $rs['result'] = true; | |
| $this->json($rs); | |
| case 'load': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| $this->attachPrivacyLogResult($this->extractPrivacyLogTargets($res['body'] ?? null)); | |
| $this->json($res); | |
| break; | |
| case 'download': | |
| $res = $ghostDepositor->loadGhostDepositor($requestPostParams); | |
| // 엑셀 다운로드는 다른 엑셀과 같이 처리건수만 남긴다 | |
| $this->attachPrivacyLogResult([], is_array($res['body'] ?? null) ? count($res['body']) : null); | |
| $ghostDepositor->downloadGhostDepositor($res['body']); | |
| default: | |
| exit; | |
| } | |
| /** | |
| * 조회 결과의 입금자 번호 — 결과 검증에서 누락을 감지하도록 본문과 번호의 null 을 보존한다 | |
| * | |
| * @param mixed $body 조회 결과 행 목록 | |
| * @return array|null | |
| */ | |
| protected function extractPrivacyLogTargets(mixed $body): ?array | |
| { | |
| return is_array($body) | |
| ? array_map(static fn(mixed $row): mixed => is_array($row) ? ($row['sno'] ?? null) : null, $body) | |
| : null; | |
| } | |
| } | |
변경 전CashReceiptPsController.php
| // --- 현금영수증 개별 발급 요청 저장 | |
| case 'cash_receipt_register': | |
| try { | |
| // 개별 발급 요청 저장 | |
| $cashReceipt->saveCashReceiptEach($postValue); | |
| $this->layer(__('저장이 완료되었습니다.')); | |
| } catch (\Exception $e) { | |
변경 후CashReceiptPsController.php
| // --- 현금영수증 개별 발급 요청 저장 | |
| case 'cash_receipt_register': | |
| try { | |
| // 개별 발급 요청 저장 — 주문번호 없이 발급하면 저장 시 생성되므로 저장 후 접속기록에 채운다 | |
| $saved = false; | |
| try { | |
| $cashReceipt->saveCashReceiptEach($postValue); | |
| $saved = true; | |
| } finally { | |
| $savedOrderNo = $cashReceipt->getSavedOrderNo(); | |
| if ($saved || !empty($savedOrderNo)) { | |
| $this->attachPrivacyLogResult([$savedOrderNo]); | |
| } | |
| } | |
| $this->layer(__('저장이 완료되었습니다.')); | |
| } catch (\Exception $e) { | |
변경 전EpostReturnRequestController.php
| use Component\Page\Page; | |
| use DTO\Order\EpostReturnSearchDTO; | |
| use Framework\Debug\Exception\AlertBackException; | |
| use Origin\Service\Order\EpostReturnAccessLogService; | |
| use Origin\Service\Privacy\Masking\OrderListMaskingService; | |
| use Request; | |
| */ | |
| class EpostReturnRequestController extends \Controller\Admin\Controller | |
| { | |
| private const LOG_MENU = '주문/배송>택배연동 서비스>우체국택배 수거신청'; | |
| private const LOG_PAGE = '우체국택배 수거신청'; | |
| private const LOG_ACTION = '수거신청 대상 조회'; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| $targetList = \App::getInstance(EpostReturnAdmin::class)->getTargetList($getValue); | |
| // 개인정보 마스킹(주문 리스트): 주문자명→회원유형, 주문자 휴대폰·ID·수령자명·입금자명·입금계좌→'-' | |
| $targetList = \App::getInstance(OrderListMaskingService::class)->maskOrderList($targetList); | |
| $this->writeAccessLog($targetList['data'], $targetList['total']); | |
| // [수거 신청] 쓰기 권한 — 화면은 얼럿 판정 재료만 받고 최종 차단은 PS 서버 검증 | |
| $naviMenu = $this->getData('naviMenu'); | |
| $this->getView()->setDefine('epostReturnResult', 'order/epost_return_request/epost_return_request_result.php'); | |
| // 수거 신청 처리 후 재조회 | |
| if (Request::isAjax()) { | |
| $this->getView()->setData($this->getData()); | |
| echo $this->getView()->render('epostReturnResult'); | |
| exit; | |
| /** | |
| * 수거신청 대상 조회 접속기록 | |
| * | |
| * @param array $rows 조회된 대상 행 | |
| * @param int $total 검색 건수 | |
| */ | |
| protected function writeAccessLog(array $rows, int $total): void | |
| { | |
| $session = \App::getInstance('session'); | |
| $orderNos = array_values(array_unique(array_column($rows, 'orderNo'))); | |
| \App::getInstance(EpostReturnAccessLogService::class)->write( | |
| __(self::LOG_MENU), | |
| __(self::LOG_PAGE), | |
| __(self::LOG_ACTION), | |
| (string)$session->get('manager.sno'), | |
| (string)$session->get('manager.managerId'), | |
| (string)$session->get('manager.scmNo'), | |
| preg_replace('#^/{2,}#', '/', (Request::getRequestUri() ?? '')), | |
| (string)Request::getReferer(), | |
| (string)Request::getRemoteAddress(), | |
| ['searchData' => gd_implode(', ', $orderNos), 'searchCnt' => $total] | |
| ); | |
| } | |
| } | |
변경 후EpostReturnRequestController.php
| use Component\Page\Page; | |
| use DTO\Order\EpostReturnSearchDTO; | |
| use Framework\Debug\Exception\AlertBackException; | |
| use Origin\Service\Privacy\Masking\OrderListMaskingService; | |
| use Request; | |
| */ | |
| class EpostReturnRequestController extends \Controller\Admin\Controller | |
| { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| $targetList = \App::getInstance(EpostReturnAdmin::class)->getTargetList($getValue); | |
| // 개인정보 마스킹(주문 리스트): 주문자명→회원유형, 주문자 휴대폰·ID·수령자명·입금자명·입금계좌→'-' | |
| $targetList = \App::getInstance(OrderListMaskingService::class)->maskOrderList($targetList); | |
| // [수거 신청] 쓰기 권한 — 화면은 얼럿 판정 재료만 받고 최종 차단은 PS 서버 검증 | |
| $naviMenu = $this->getData('naviMenu'); | |
| $this->getView()->setDefine('epostReturnResult', 'order/epost_return_request/epost_return_request_result.php'); | |
| // 수거 신청 처리 후 재조회 — exit 로 끝나 AdminLog 인터셉터가 돌지 않으므로 접속기록을 직접 남김 | |
| if (Request::isAjax()) { | |
| $this->writePrivacyLog(); | |
| $this->getView()->setData($this->getData()); | |
| echo $this->getView()->render('epostReturnResult'); | |
| exit; | |
| /** | |
| * 수거신청 대상 조회 접속기록 | |
| * | |
| * @deprecated | |
| * | |
| * @param array $rows 조회된 대상 행 | |
| * @param int $total 검색 건수 | |
| */ | |
| protected function writeAccessLog(array $rows, int $total): void | |
| { | |
| } | |
| } | |
변경 전EpostReturnRequestPsController.php
| use Component\Order\EpostReturnAdmin; | |
| use Origin\DTO\Order\EpostReturnRequestResultDTO; | |
| use Origin\Exception\Order\EpostReturnRequestRejectedException; | |
| use Origin\Service\Order\EpostReturnAccessLogService; | |
| use Request; | |
| use Throwable; | |
| */ | |
| class EpostReturnRequestPsController extends \Controller\Admin\Controller | |
| { | |
| private const LOG_MENU = '주문/배송>택배연동 서비스>우체국택배 수거신청'; | |
| private const LOG_PAGE = '우체국택배 수거신청'; | |
| private const LOG_ACTION = '우체국 수거 예약 전송(고객 정보 조회·전송 포함)'; | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| $result = \App::getInstance(EpostReturnAdmin::class) | |
| ->applyManualRequest((bool)$writable['check'], !gd_is_provider(), $orderGoodsSnos); | |
| // 자격 검증을 통과해 전송 단계까지 갔을 때만 남김 — 거부는 예외로 빠져 여기 오지 않음 | |
| $this->writePickupRequestAccessLog($orderGoodsSnos, $result); | |
| $this->json([ | |
| 'code' => 200, | |
| 'requestedCount' => count($orderGoodsSnos), | |
| $reason = $e->getReason(); | |
| $this->json(['code' => 0, 'reason' => $reason->value, 'message' => __($reason->alertTitle()), 'subMessage' => __($reason->alertSubtitle())]); | |
| } catch (Throwable $e) { | |
| // 전송 도중 실패라도 고객 정보 조회·전송이 이미 일어났을 수 있어 접속기록은 남김(신청 결과가 없으니 대상 목록만) | |
| \App::getInstance('logger')->channel('epost')->error('우체국택배 수거 신청 실패', ['orderGoodsSnos' => $orderGoodsSnos, 'exception' => $e]); | |
| $this->writePickupRequestAccessLog($orderGoodsSnos, null); | |
| $this->json(['code' => 0, 'reason' => 'ERROR', 'message' => __('수거 신청에 실패하였습니다.'), 'subMessage' => __('잠시 후 다시 시도해 주세요.')]); | |
| } | |
| } | |
| /** | |
| * 수거 신청 접속기록 — 실행당 1건, 처리 대상은 data 에 담음 | |
| * | |
| * @param array $orderGoodsSnos 신청 대상 주문상품번호 | |
| * @param ?EpostReturnRequestResultDTO $result 신청 결과 — 전송 도중 실패로 없으면 null | |
| */ | |
| protected function writePickupRequestAccessLog(array $orderGoodsSnos, ?EpostReturnRequestResultDTO $result): void | |
| { | |
| $session = \App::getInstance('session'); | |
| \App::getInstance(EpostReturnAccessLogService::class)->write( | |
| __(self::LOG_MENU), | |
| __(self::LOG_PAGE), | |
| __(self::LOG_ACTION), | |
| (string)$session->get('manager.sno'), | |
| (string)$session->get('manager.managerId'), | |
| (string)$session->get('manager.scmNo'), | |
| preg_replace('#^/{2,}#', '/', (Request::getRequestUri() ?? '')), | |
| (string)Request::getReferer(), | |
| (string)Request::getRemoteAddress(), | |
| $result !== null ? [ | |
| 'orderGoodsSnos' => $orderGoodsSnos, | |
| 'successCount' => $result->getSuccessCount(), | |
| 'failureCount' => $result->getFailureCount(), | |
| 'excludedCount' => count($result->getExcludedOrderGoodsSnos()), | |
| ] : ['orderGoodsSnos' => $orderGoodsSnos, 'error' => true] | |
| ); | |
| } | |
| } | |
변경 후EpostReturnRequestPsController.php
| use Component\Order\EpostReturnAdmin; | |
| use Origin\DTO\Order\EpostReturnRequestResultDTO; | |
| use Origin\Exception\Order\EpostReturnRequestRejectedException; | |
| use Request; | |
| use Throwable; | |
| */ | |
| class EpostReturnRequestPsController extends \Controller\Admin\Controller | |
| { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| $result = \App::getInstance(EpostReturnAdmin::class) | |
| ->applyManualRequest((bool)$writable['check'], !gd_is_provider(), $orderGoodsSnos); | |
| $this->json([ | |
| 'code' => 200, | |
| 'requestedCount' => count($orderGoodsSnos), | |
| $reason = $e->getReason(); | |
| $this->json(['code' => 0, 'reason' => $reason->value, 'message' => __($reason->alertTitle()), 'subMessage' => __($reason->alertSubtitle())]); | |
| } catch (Throwable $e) { | |
| \App::getInstance('logger')->channel('epost')->error('우체국택배 수거 신청 실패', ['orderGoodsSnos' => $orderGoodsSnos, 'exception' => $e]); | |
| $this->json(['code' => 0, 'reason' => 'ERROR', 'message' => __('수거 신청에 실패하였습니다.'), 'subMessage' => __('잠시 후 다시 시도해 주세요.')]); | |
| } | |
| } | |
| /** | |
| * 수거 신청 접속기록 | |
| * | |
| * @deprecated | |
| * | |
| * @param array $orderGoodsSnos 신청 대상 주문상품번호 | |
| * @param ?EpostReturnRequestResultDTO $result 신청 결과 — 전송 도중 실패로 없으면 null | |
| */ | |
| protected function writePickupRequestAccessLog(array $orderGoodsSnos, ?EpostReturnRequestResultDTO $result): void | |
| { | |
| } | |
| } | |
변경 전OrderPsController.php
| try { | |
| $excelOrderConvert = App::load('Component\\Excel\\ExcelOrderConvert'); | |
| $result = $excelOrderConvert->updateOrderInvoiceExcel(Request::files()->toArray()); | |
| $this->json($result); | |
| exit; | |
| } catch (Exception $e) { | |
| case 'register_frequency': | |
| try { | |
| $postValue = StringUtils::xssArrayClean(Request::request()->toArray()); | |
| $order->registerFrequencyAddress($postValue); | |
| throw new LayerException(); | |
| } catch (Exception $e) { | |
| // 주문 저장 후 처리 | |
| if ($result) { | |
| // Kafka MQ처리 | |
| $mqData = [ | |
| 'cartInfo' => ['cartSnos' => is_array($cart->cartSno) ? $cart->cartSno : [$cart->cartSno]], | |
변경 후OrderPsController.php
| try { | |
| $excelOrderConvert = App::load('Component\\Excel\\ExcelOrderConvert'); | |
| $result = $excelOrderConvert->updateOrderInvoiceExcel(Request::files()->toArray()); | |
| // 그룹코드를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (is_array($result) && !empty($result['groupCd'])) { | |
| $this->attachPrivacyLogResult([$result['groupCd']], $result['total'] ?? null); | |
| } | |
| $this->json($result); | |
| exit; | |
| } catch (Exception $e) { | |
| case 'register_frequency': | |
| try { | |
| $postValue = StringUtils::xssArrayClean(Request::request()->toArray()); | |
| $result = $order->registerFrequencyAddress($postValue); | |
| // 등록은 새로 생긴 주소 번호, 수정은 요청한 주소 번호를 남기고, 번호를 받지 못하면 처리 전 기록만 남긴다 | |
| $frequencySno = empty($postValue['sno']) ? $result : $postValue['sno']; | |
| if (is_numeric($frequencySno)) { | |
| $this->attachPrivacyLogResult([(string) $frequencySno]); | |
| } | |
| throw new LayerException(); | |
| } catch (Exception $e) { | |
| // 주문 저장 후 처리 | |
| if ($result) { | |
| $this->attachPrivacyLogResult([$order->orderNo]); | |
| // Kafka MQ처리 | |
| $mqData = [ | |
| 'cartInfo' => ['cartSnos' => is_array($cart->cartSno) ? $cart->cartSno : [$cart->cartSno]], | |
변경 전PostPsController.php
| use Framework\Debug\Exception\LayerException; | |
| use Framework\Debug\Exception\AlertRedirectException; | |
| use Message; | |
| use Origin\Service\Order\EpostReturnAccessLogService; | |
| use Request; | |
| /** | |
| */ | |
| class PostPsController extends \Controller\Admin\Controller | |
| { | |
| private const LOG_MENU = '주문/배송>택배연동 서비스>우체국택배 신청/관리'; | |
| private const LOG_PAGE = '우체국택배 신청/관리'; | |
| private const LOG_ACTION = '배송상태 수동 업데이트'; | |
| /** | |
| * index | |
| * | |
| } | |
| $result = $orderAdmin->saveOrderInvoice($postValue); | |
| if(gd_count($result) > 0 ) { | |
| throw new LayerException(sprintf(__("필수 정보(수령자명,수령자 핸드폰번호,수령자 주소,수령자 우편번호,주문자명) 가 누락된 주문(%s) 외 우체국 택배 송장번호가 발급되었습니다."), gd_implode(",",$result)),null,null,null,6000); | |
| throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.')); | |
| } | |
| $orderAdmin->reserveOrderInvoice($postValue); | |
| throw new LayerException(__("우체국택배로 예약되었습니다.")); | |
| break; | |
| // 우체국택배 취소 | |
| $updated = (int)\App::load('\\Component\\Godo\\GodoPostServerApi')->saveManualUpdate(); | |
| // 반품(02) 재동기화 — 연동 신청을 마친 상점에만 조회할 이력이 생김. | |
| // 실패해도 이미 커밋된 발송(01) 갱신의 감사기록·응답은 이어가야 해 여기서 막음(원인은 resync() 자신이 로깅함) | |
| $epostApprovalNo = (string)(gd_policy(EpostReturnAdmin::POLICY_KEY)['compdivcd'] ?? ''); | |
| if ($epostApprovalNo !== '') { | |
| try { | |
| } | |
| } | |
| $this->writeManualUpdateAccessLog($updated, $epostApprovalNo !== ''); | |
| $this->json(['code' => 200, 'updatedCount' => $updated]); | |
| return; | |
| } | |
| /** | |
| * 배송상태 수동 업데이트 접속기록 — 실행당 1건, 처리 대상은 data 에 담음 | |
| * | |
| * @param int $updatedCount 발송(01) 갱신 건수 | |
| * @param bool $returnResync 반품(02) 재동기화 실행 여부 | |
| */ | |
| protected function writeManualUpdateAccessLog(int $updatedCount, bool $returnResync): void | |
| { | |
| $session = \App::getInstance('session'); | |
| \App::getInstance(EpostReturnAccessLogService::class)->write( | |
| __(self::LOG_MENU), | |
| __(self::LOG_PAGE), | |
| __(self::LOG_ACTION), | |
| (string)$session->get('manager.sno'), | |
| (string)$session->get('manager.managerId'), | |
| (string)$session->get('manager.scmNo'), | |
| preg_replace('#^/{2,}#', '/', (Request::getRequestUri() ?? '')), | |
| (string)Request::getReferer(), | |
| (string)Request::getRemoteAddress(), | |
| ['updatedCount' => $updatedCount, 'returnResync' => $returnResync ? 'y' : 'n'] | |
| ); | |
| } | |
| } | |
변경 후PostPsController.php
| use Framework\Debug\Exception\LayerException; | |
| use Framework\Debug\Exception\AlertRedirectException; | |
| use Message; | |
| use Request; | |
| /** | |
| */ | |
| class PostPsController extends \Controller\Admin\Controller | |
| { | |
| /** | |
| * index | |
| * | |
| } | |
| $result = $orderAdmin->saveOrderInvoice($postValue); | |
| // 발급한 주문번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| $issuedOrderNos = method_exists($orderAdmin, 'getIssuedInvoiceOrderNos') | |
| ? $orderAdmin->getIssuedInvoiceOrderNos() | |
| : []; | |
| if (!empty($issuedOrderNos)) { | |
| $this->attachPrivacyLogResult($issuedOrderNos); | |
| } | |
| if(gd_count($result) > 0 ) { | |
| throw new LayerException(sprintf(__("필수 정보(수령자명,수령자 핸드폰번호,수령자 주소,수령자 우편번호,주문자명) 가 누락된 주문(%s) 외 우체국 택배 송장번호가 발급되었습니다."), gd_implode(",",$result)),null,null,null,6000); | |
| throw new LayerException(__('우체국택배 서비스 신청 후 이용 가능합니다.')); | |
| } | |
| $reservedOrderNos = $orderAdmin->reserveOrderInvoice($postValue); | |
| // 예약한 주문번호를 돌려받지 못하면 처리 전 기록만 남긴다 | |
| if (!empty($reservedOrderNos)) { | |
| $this->attachPrivacyLogResult($reservedOrderNos); | |
| } | |
| throw new LayerException(__("우체국택배로 예약되었습니다.")); | |
| break; | |
| // 우체국택배 취소 | |
| $updated = (int)\App::load('\\Component\\Godo\\GodoPostServerApi')->saveManualUpdate(); | |
| // 반품(02) 재동기화 — 연동 신청을 마친 상점에만 조회할 이력이 생김. | |
| // 실패해도 이미 커밋된 발송(01) 갱신의 응답은 이어가야 해 여기서 막음(원인은 resync() 자신이 로깅함) | |
| $epostApprovalNo = (string)(gd_policy(EpostReturnAdmin::POLICY_KEY)['compdivcd'] ?? ''); | |
| if ($epostApprovalNo !== '') { | |
| try { | |
| } | |
| } | |
| $this->json(['code' => 200, 'updatedCount' => $updated]); | |
| return; | |
| } | |
| /** | |
| * 배송상태 수동 업데이트 접속기록 | |
| * | |
| * @deprecated | |
| * | |
| * @param int $updatedCount 발송(01) 갱신 건수 | |
| * @param bool $returnResync 반품(02) 재동기화 실행 여부 | |
| */ | |
| protected function writeManualUpdateAccessLog(int $updatedCount, bool $returnResync): void | |
| { | |
| } | |
| } | |
변경 전LayerExcelPsController.php
| $request->request()->set($fileInfo['menu'] . 'Log', true); | |
| $request->post()->set('fileName', $fileName[$postValue['excelKey']]); | |
| $request->post()->set('downloadFileName', $fileInfo['downloadFileName']); | |
| $request->post()->set('totalCount', $fileInfo['totalCount']); | |
| $logAction = \App::load('Component\\Admin\\AdminLogDAO'); | |
| $logAction->setAdminLog(); | |
| } | |
변경 후LayerExcelPsController.php
| $request->request()->set($fileInfo['menu'] . 'Log', true); | |
| $request->post()->set('fileName', $fileName[$postValue['excelKey']]); | |
| $request->post()->set('downloadFileName', $fileInfo['downloadFileName']); | |
| $downloadTotalCount = $fileInfo['totalCount'] ?? null; | |
| if (method_exists($excelRequest, 'getDownloadTotalCount')) { | |
| $downloadTotalCount = $excelRequest->getDownloadTotalCount($fileInfo, $postValue['excelKey']); | |
| } | |
| $request->post()->set('totalCount', $downloadTotalCount); | |
| $logAction = \App::load('Component\\Admin\\AdminLogDAO'); | |
| $logAction->setAdminLog(); | |
| } | |