From 6610489071f7e8cd6d8ac31ea35cc301659e7393 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 13 Jul 2022 20:02:23 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A3=BC=EC=A0=95=EC=B0=A8=20=EC=8B=AC?= =?UTF-8?q?=EC=82=AC=20=EB=B0=98=EC=98=81=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/database/BaseMpowerDaoSupport.java | 126 +----------------- 1 file changed, 7 insertions(+), 119 deletions(-) diff --git a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java index 2141c92..7534a10 100644 --- a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java +++ b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java @@ -530,9 +530,10 @@ public abstract class BaseMpowerDaoSupport { log.info("서버 download file name :::::" + strpath + "A, B, C, D.jpg"); File file = new File(svrSavedPhotoPath); - if(!file.exists()) file.mkdirs(); + if(Checks.isNotEmpty(client.getFileName("imageA"))){ + if(!file.exists()) file.mkdirs(); client.savefile("imageA", svrSavedPhotoPath); setFileInfo(list, client.getFileName("imageA"), strpath); log.info("서버 file name :::::" + strpath + client.getFileName("imageA")); @@ -541,6 +542,7 @@ public abstract class BaseMpowerDaoSupport { }; if(Checks.isNotEmpty(client.getFileName("imageB"))){ + if(!file.exists()) file.mkdirs(); client.savefile("imageB", svrSavedPhotoPath); setFileInfo(list, client.getFileName("imageB"), strpath); log.info("서버 file name :::::" + strpath + client.getFileName("imageB")); @@ -548,6 +550,7 @@ public abstract class BaseMpowerDaoSupport { setNoFileInfo(list);; }; if(Checks.isNotEmpty(client.getFileName("imageC"))){ + if(!file.exists()) file.mkdirs(); client.savefile("imageC", svrSavedPhotoPath); setFileInfo(list, client.getFileName("imageC"), strpath); log.info("서버 file name :::::" + strpath + client.getFileName("imageC")); @@ -555,6 +558,7 @@ public abstract class BaseMpowerDaoSupport { setNoFileInfo(list);; }; if(Checks.isNotEmpty(client.getFileName("imageD"))){ + if(!file.exists()) file.mkdirs(); client.savefile("imageD", svrSavedPhotoPath); setFileInfo(list, client.getFileName("imageD"), strpath); log.info("서버 file name :::::" + strpath + client.getFileName("imageD")); @@ -587,77 +591,12 @@ public abstract class BaseMpowerDaoSupport { list.add(map); } -// public ParkingImageDto getPicadImgList2(String photocode){ -// ParkingImageDto dto = new ParkingImageDto(); -// -// Client client = new Client(fileHostIp, fileHostPort); -// -// String path = Application.class.getResource("").getPath(); -// path = path.replace("WEB-INF/classes/com/xit", "vioPhoto/picad/"); -// if(path.substring(0,1).equals("/")){ -// path = path.substring(1); -// } -// File file = new File(path); -// if(!file.exists()) file.mkdirs(); -// -// String imgPath = picadPath + getAbsImgPath(photocode); //터널링에 저장된 단속사진 경로 -// log.info("최종이미지경로:::::" + imgPath); -// -// try{ -// client.getConnection(fileServiceName); -// client.setInput("dnfile1",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "A.jpg"); //터널링에 실질 존재하는 경로,파일명 -// log.info("사진이름:" + CommUtil.lpad(photocode, '0', 10)); -// -// client.setInput("dnfile2",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "B.jpg"); -// client.setInput("dnfile3",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "C.jpg"); -// client.setInput("dnfile4",imgPath+ "/P" + CommUtil.lpad(photocode, '0', 10) + "D.jpg"); -// -// client.Request(); -// String result = client.getString("result", 0, 0); -// -// if (result.equals("true")){ -// log.info("{}{}{}{}", client.getFileName("dnfile1"), client.getFileName("dnfile2"), client.getFileName("dnfile3"), client.getFileName("dnfile4")); -// log.info("{}{}{}{}", client.getFileName("imageA"), client.getFileName("imageB"), client.getFileName("imageC"), client.getFileName("imageD")); -// -// client.getFileName("imageA"); -// client.getFileName("imageB"); -// client.getFileName("imageC"); -// client.getFileName("imageD"); -// client.savefile("imageA", path); -// client.savefile("imageB", path); -// client.savefile("imageC", path); -// client.savefile("imageD", path); -// log.info("{}{}{}{}", client.getFileName("dnfile1"), client.getFileName("dnfile2"), client.getFileName("dnfile3"), client.getFileName("dnfile4")); -// log.info("{}{}{}{}", client.getFileName("imageA"), client.getFileName("imageB"), client.getFileName("imageC"), client.getFileName("imageD")); -// -// //String strpath = "/vioPhoto/"+sessionId+"/P" + CommUtil.lpad(photocode, '0', 10); -// String strpath = "/vioPhoto/picad" + "/P" + CommUtil.lpad(photocode, '0', 10); -// log.info("strPath ::: " + strpath); -// dto.setScPicad1(strpath + "A.jpg"); -// dto.setScPicad2(strpath + "B.jpg"); -// dto.setScPicad3(strpath + "C.jpg"); -// dto.setScPicad4(strpath + "D.jpg"); -// }else{ -// throw new MpowerException("MPower File download error::"+result); -// } -// }catch(Exception e){ -// throw new MpowerException("MPower File download error::"+e.getLocalizedMessage()); -// } -// //logger.debug(fph); -// return dto; -// } - - /** - * Mpower 단속사진 저장 경로 - * @param code - * @return - */ public String getAbsImgPath(String code){ code = Checks.checkEmptyVal(code,"0"); double intCode = Double.parseDouble(code); return getImgPath(intCode, "00001", 10000) + "/" - + getImgPath(intCode, "0001", 1000) + "/" + + getImgPath(Double.parseDouble(code.substring(code.length()-4, code.length())), "0001", 1000) + "/" + getImgPath(Double.parseDouble(code.substring(code.length()-3, code.length())), "001", 100); } @@ -672,63 +611,12 @@ public abstract class BaseMpowerDaoSupport { tmpS = tmpS.substring(tmpS.indexOf(".")+1); int tmpM = Integer.parseInt(tmpS); - if(tmpM > 0) tmpL = tmpL+1; StringBuilder stmpL = new StringBuilder(String.valueOf(tmpL)); int tmpCnt = baseDir.length() - stmpL.length(); for(int i = 0; i < tmpCnt; i++) stmpL.insert(0, "0"); + return stmpL.toString(); } - } - -/* - -//첨부파일 터널링 서버로 복사 - public void fnFileUpload(String tmpFileLocation,String realRcRilenm){ - String fph = tunullingFile; //터널링에 복사되는 파일경로 - try{ - Client mp = new Client("127.0.0.1", 2500); - mp.getConnection("XitFile.XitUpload"); - mp.setInput("dir",tunullingFile); - mp.setInput("upfile1",tmpFileLocation+realRcRilenm,true); - mp.Request(); - }catch(Exception e){ - e.printStackTrace(); - } - //logger.debug(fph); - } - - - //터널링에서 웹서버로 첨부파일 복사 - public static void fnDownFile(String fileName,String sessionId){ - String serviceName = "XitFile.XitDownload"; - String fph = MpowerUtil.class.getResource("").getPath(); - fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/"); //웹서버 저장 위치 - String fphs = fph.substring(0,1); - if(fphs.equals("/")){ - fph = fph.substring(1); - } - String tmpTunullingFile = tunullingFile; //터널링에 저장된 단속사진 경로 - - try{ - Client mp = new Client("127.0.0.1", 2500); - mp.getConnection("XitFile.XitDownload"); - mp.setInput("dnfile1",tmpTunullingFile+ fileName); //터널링에 실질 존재하는 경로,파일명 - mp.Request(); - String result = mp.getString("result", 0, 0); - - if (result.equals("true")){ - mp.getFileName("imageA"); - mp.savefile("imageA", fph); - } - }catch(Exception e){ - e.printStackTrace(); - } - //logger.debug("웹서버 저장되는 첨부파일 위치:"+fph); - System.out.println("웹서버 저장되는 첨부파일 위치:"+fph); - } - - - */