From 5469037de9f2cf9e48eb50197ff77c2992c44ace Mon Sep 17 00:00:00 2001 From: ysCha Date: Mon, 28 Jul 2025 14:06:59 +0900 Subject: [PATCH] =?UTF-8?q?[1205]=20DXF=20=3D>=20PNG=20=EC=B6=94=EA=B0=80,?= =?UTF-8?q?=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EC=9D=BC=EB=B3=B8=EC=96=B4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 3 +- .env.localhost | 8 ++- .env.production | 3 +- qcast3.database.sqlite | Bin 16384 -> 16384 bytes src/hooks/common/useRefFiles.js | 88 ++++++++++++++++++++------------ src/locales/ja.json | 2 + src/locales/ko.json | 2 + 7 files changed, 69 insertions(+), 37 deletions(-) diff --git a/.env.development b/.env.development index 46694e6d..ec409311 100644 --- a/.env.development +++ b/.env.development @@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" -NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" diff --git a/.env.localhost b/.env.localhost index 8617d87c..3b355869 100644 --- a/.env.localhost +++ b/.env.localhost @@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" -NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="http://q-order-stg.q-cells.jp:8120/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="http://q-musubi-stg.q-cells.jp:8120/qm/login/autoLogin" @@ -29,4 +30,7 @@ AWS_ACCESS_KEY_ID="AKIA3K4QWLZHFZRJOM2E" AWS_SECRET_ACCESS_KEY="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" NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp" -S3_PROFILE="dev" \ No newline at end of file +S3_PROFILE="dev" + +#logging +NEXT_PUBLIC_ENABLE_LOGGING=false diff --git a/.env.production b/.env.production index 4a63486a..6e2981d9 100644 --- a/.env.production +++ b/.env.production @@ -10,7 +10,8 @@ SESSION_SECRET="i3iHH1yp2/2SpQSIySQ4bpyc4g0D+zCF9FAn5xUG0+Y=" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_bV5zuYMyyIYFlOb3" # NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_yAS4QDalL9jgQ7vS" -NEXT_PUBLIC_CONVERTER_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DWG_API_URL="https://v2.convertapi.com/convert/dwg/to/png?Secret=secret_a0FLEK6M2oTpXInK" +NEXT_PUBLIC_CONVERTER_DXF_API_URL="https://v2.convertapi.com/convert/dxf/to/png?Secret=secret_a0FLEK6M2oTpXInK" NEXT_PUBLIC_Q_ORDER_AUTO_LOGIN_URL="https://q-order.q-cells.jp/eos/login/autoLogin" NEXT_PUBLIC_Q_MUSUBI_AUTO_LOGIN_URL="https://q-musubi.q-cells.jp/qm/login/autoLogin" diff --git a/qcast3.database.sqlite b/qcast3.database.sqlite index 6a7a809a38f22f297032357b29759527ebbd7c22..840b3282bfafa863f4a17323f467e00715643e9e 100644 GIT binary patch delta 92 zcmZo@U~Fh$oFL7ZF;T{uF=J!Ge0^SBUIqpRCjKM_{vG^Dn|Ta0`S}_dblDh085_$@ mO)U)BCTH2p^M*h~YA9CS?VSx zo15yICmNVqm>Q*|nx+})738Igu`!5pHaeTeh_f+7NP{_=riP{#lk@E@1xpKZ@)J|^ T3-XIg(u-1y3v(uKvG)N0vHBl5 diff --git a/src/hooks/common/useRefFiles.js b/src/hooks/common/useRefFiles.js index be3b9abf..4c037d0c 100644 --- a/src/hooks/common/useRefFiles.js +++ b/src/hooks/common/useRefFiles.js @@ -9,6 +9,8 @@ import { deleteBackGroundImage, setBackGroundImage } from '@/lib/imageActions' import { settingModalFirstOptionsState } from '@/store/settingAtom' import { popSpinnerState } from '@/store/popupAtom' import Config from '@/config/config.export' +import { useMessage } from '@/hooks/useMessage' +import { logger } from '@/util/logger' /** * 배경 이미지 관리 @@ -23,7 +25,9 @@ import Config from '@/config/config.export' * @returns {object} */ export function useRefFiles() { - const converterUrl = process.env.NEXT_PUBLIC_CONVERTER_API_URL + const converterDwgUrl = process.env.NEXT_PUBLIC_CONVERTER_DWG_API_URL + const converterDxfUrl = process.env.NEXT_PUBLIC_CONVERTER_DXF_API_URL + const { getMessage } = useMessage() const [refImage, setRefImage] = useState(null) const [refFileMethod, setRefFileMethod] = useState('1') const [mapPositionAddress, setMapPositionAddress] = useState('') @@ -50,12 +54,12 @@ export function useRefFiles() { * @param {*} file */ const handleRefFile = (file) => { - console.log('handleRefFile', file) - console.log('refImage', refImage) + logger.log('handleRefFile', file) + logger.log('refImage', refImage) if (refImage) { swalFire({ - text: '파일을 변경하시겠습니까?', + text: getMessage('common.message.ref.file.change'), type: 'confirm', confirmFn: () => { refFileSetting(file) @@ -71,15 +75,29 @@ export function useRefFiles() { * @param {File} file */ const refFileSetting = (file) => { - console.log('🚀 ~ refFileSetting ~ file:', file) + logger.log('🚀 ~ refFileSetting ~ file:', file) + + setPopSpinnerStore(true) + const newOption1 = settingModalFirstOptions.option1.map((option) => ({ + ...option, + selected: option.column === 'imageDisplay' ? true : option.selected, + })) + + setSettingModalFirstOptions((prev) => ({ + ...prev, + option1: newOption1, + })) + if (file.name.split('.').pop() === 'dwg') { - handleUploadConvertRefFile(file) + handleUploadConvertRefFile(file, converterDwgUrl); + } else if (file.name.split('.').pop() === 'dxf') { + handleUploadConvertRefFile(file, converterDxfUrl); } else { if (file && ['image/png', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/gif'].includes(file.type)) { handleUploadImageRefFile(file) } else { swalFire({ - text: '이미지가 아닙니다.', + text: getMessage('common.message.ref.file.noImage'), type: 'alert', icon: 'error', }) @@ -92,12 +110,12 @@ export function useRefFiles() { */ const handleFileDelete = async () => { swalFire({ - text: '삭제하시겠습니까?', + text: getMessage('common.message.data.delete'), type: 'confirm', confirmFn: async () => { setPopSpinnerStore(true) - console.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage) - console.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) + logger.log('🚀 ~ handleFileDelete ~ handleFileDelete:', refImage) + logger.log('🚀 ~ handleFileDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) await del({ url: `${Config().baseUrl}/api/image/upload?fileName=${currentCanvasPlan.bgImageName}` }) setCurrentBgImage(null) await deleteBackGroundImage({ @@ -114,11 +132,11 @@ export function useRefFiles() { */ const handleAddressDelete = async () => { swalFire({ - text: '삭제하시겠습니까?', + text: getMessage('common.message.data.delete'), type: 'confirm', confirmFn: async () => { - console.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage) - console.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) + logger.log('🚀 ~ handleAddressDelete ~ handleAddressDelete:', refImage) + logger.log('🚀 ~ handleAddressDelete ~ currentCanvasPlan.bgImageName:', currentCanvasPlan.bgImageName) await del({ url: `${Config().baseUrl}/api/image/map?fileName=${currentCanvasPlan.bgImageName}` }) setMapPositionAddress('') setCurrentBgImage(null) @@ -134,7 +152,7 @@ export function useRefFiles() { * 주소로 구글 맵 이미지 다운로드하여 캔버스 배경으로 로드 */ const handleMapImageDown = async () => { - console.log('🚀 ~ handleMapImageDown ~ handleMapImageDown:') + debugger; logger.log('🚀 ~ handleMapImageDown ~ handleMapImageDown:') if (queryRef.current.value === '' || queryRef.current.value === null) { return } @@ -152,7 +170,7 @@ export function useRefFiles() { const res = await get({ url: `${Config().baseUrl}/api/image/map?q=${queryRef.current.value}&fileNm=${currentCanvasPlan.id}&zoom=20`, }) - console.log('🚀 ~ handleMapImageDown ~ res:', res) + logger.log('🚀 ~ handleMapImageDown ~ res:', res) setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) await setBackGroundImage({ @@ -170,9 +188,11 @@ export function useRefFiles() { // if (!currentBgImage) { // return // } - console.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage) + logger.log('🚀 ~ useEffect ~ currentBgImage:', currentBgImage) if (currentBgImage) { - handleBackImageLoadToCanvas(currentBgImage) + handleBackImageLoadToCanvas(currentBgImage, () => { + logger.log('Background image loaded successfully') + }) setCurrentCanvasPlan((prev) => ({ ...prev, // bgImageName: refImage?.name ?? null, @@ -194,16 +214,16 @@ export function useRefFiles() { * @param {*} file */ const handleUploadImageRefFile = async (file) => { - setPopSpinnerStore(true) - const newOption1 = settingModalFirstOptions.option1.map((option) => ({ - ...option, - selected: option.column === 'imageDisplay' ? true : option.selected, - })) - - setSettingModalFirstOptions((prev) => ({ - ...prev, - option1: newOption1, - })) + // setPopSpinnerStore(true) + // const newOption1 = settingModalFirstOptions.option1.map((option) => ({ + // ...option, + // selected: option.column === 'imageDisplay' ? true : option.selected, + // })) + // + // setSettingModalFirstOptions((prev) => ({ + // ...prev, + // option1: newOption1, + // })) const formData = new FormData() formData.append('file', file) @@ -212,7 +232,7 @@ export function useRefFiles() { url: `${Config().baseUrl}/api/image/upload`, data: formData, }) - console.log('🚀 ~ handleUploadImageRefFile ~ res:', res) + logger.log('🚀 ~ handleUploadImageRefFile ~ res:', res) setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${res.fileName}`) setRefImage(file) @@ -222,7 +242,7 @@ export function useRefFiles() { // imagePath: `${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`, imagePath: `${res.filePath}`, } - console.log('🚀 ~ handleUploadImageRefFile ~ params:', params) + logger.log('🚀 ~ handleUploadImageRefFile ~ params:', params) await setBackGroundImage(params) setPopSpinnerStore(false) } @@ -230,14 +250,15 @@ export function useRefFiles() { /** * RefFile이 캐드 도면 파일일 경우 변환하여 이미지로 저장 * @param {*} file + * @param converterUrl */ - const handleUploadConvertRefFile = async (file) => { + const handleUploadConvertRefFile = async (file, converterUrl) => { const formData = new FormData() formData.append('file', file) /** 캐드 도면 파일 변환 */ const res = await post({ url: converterUrl, data: formData }) - console.log('🚀 ~ handleUploadConvertRefFile ~ res:', res) + logger.log('🚀 ~ handleUploadConvertRefFile ~ res:', res) // Convert Base64 to Blob const base64Data = res.Files[0].FileData @@ -269,7 +290,7 @@ export function useRefFiles() { url: `${Config().baseUrl}/api/image/cad`, data: newFormData, }) - console.log('🚀 ~ handleUploadConvertRefFile ~ result:', result) + logger.log('🚀 ~ handleUploadConvertRefFile ~ result:', result) setCurrentBgImage(`${process.env.NEXT_PUBLIC_AWS_S3_BASE_URL}/${result.fileName}`) // setCurrentBgImage(result.filePath) @@ -281,8 +302,9 @@ export function useRefFiles() { // imagePath: `${process.env.NEXT_PUBLIC_HOST_URL}${res.filePath}`, imagePath: `${result.filePath}`, } - console.log('🚀 ~ handleUploadImageRefFile ~ params:', params) + logger.log('🚀 ~ handleUploadImageRefFile ~ params:', params) await setBackGroundImage(params) + setPopSpinnerStore(false) } /** diff --git a/src/locales/ja.json b/src/locales/ja.json index ec579c8e..44f723fd 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -551,6 +551,8 @@ "common.message.writeToConfirm": "作成解除を実行しますか?", "common.message.password.init.success": "パスワード[{0}]に初期化されました。", "common.message.no.edit.save": "このドキュメントは変更できません。", + "common.message.ref.file.change": "ファイルを変更しますか?", + "common.message.ref.file.noImage": "画像ではありません。", "common.load": "読込", "common.input.file": "ファイルを読み込む", "common.input.file.load": "読込", diff --git a/src/locales/ko.json b/src/locales/ko.json index de8f56c2..83ed3f2e 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -551,6 +551,8 @@ "common.message.writeToConfirm": "작성 해제를 실행하시겠습니까?", "common.message.password.init.success": "비밀번호 [{0}]로 초기화 되었습니다.", "common.message.no.edit.save": "This document cannot be changed.", + "common.message.ref.file.change": "파일을 변경하시겠습니까?", + "common.message.ref.file.noImage": "이미지가 아닙니다.", "common.load": "불러오기", "common.input.file": "파일 불러오기", "common.input.file.load": "불러오기",