From 07f86210680e6c9f44933f4feaf3e8afc95e2d8b Mon Sep 17 00:00:00 2001 From: snoop Date: Sun, 28 Jul 2019 17:50:57 +0900 Subject: [PATCH] =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=97=90=EC=9D=B4?= =?UTF-8?q?=EC=A0=84=ED=8A=B8=20+=20=EC=95=8C=EB=A6=BC=ED=86=A1=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(=EA=B2=B0=EC=A0=9C=EA=B8=88=EC=95=A1=20?= =?UTF-8?q?=EC=A0=84=EC=86=A1=ED=95=B4=EC=95=BC=ED=95=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cms_FileAgent/FileAgentPollingAction.java | 209 +++++++++--------- src/biz/cms_NhsSysInfoRcv/NhsSysInfoDAO.java | 45 +++- xml/nhssysinq-sql.xml | 15 +- xml/stsys-property.xml | 14 +- 4 files changed, 158 insertions(+), 125 deletions(-) diff --git a/src/biz/cms_FileAgent/FileAgentPollingAction.java b/src/biz/cms_FileAgent/FileAgentPollingAction.java index 681f5bf..be6f255 100644 --- a/src/biz/cms_FileAgent/FileAgentPollingAction.java +++ b/src/biz/cms_FileAgent/FileAgentPollingAction.java @@ -117,54 +117,38 @@ public class FileAgentPollingAction extends PollingAction { hm.put("USER_HOME","/home/hs_dev"); hm.put("FTP_USER_HOME", "/ftp_home/stationftp/dev/CMBO") ; hm.put("DAY_CNT", "/ftp_home/stationftp/dev/CMBO") ;*/ - - // hm.put("FTP_SERVER", "211.108.6.162"); - // hm.put("FTP_ID", "Nftp_nhs"); - // hm.put("FTP_PWD", "L6y7V>gxU\\"); - // hm.put("FTP_PORT","22"); - // hm.put("FTP_POS_PORT","21"); - // hm.put("USER_HOME","/home/hs_dev"); - // hm.put("FTP_USER_HOME", "/data/Nftp_nhs/dev/CMBO") ; - // hm.put("DAY_CNT", "/data/Nftp_nhs/dev/CMBO") ; - - // hm.put("FTP_SERVER", "10.0.40.148"); - // //hm.put("FTP_SERVER2", "10.0.40.149"); // 2019.07.10 148 접속 불가시 149 로 접속하라고 전달받음 - // hm.put("FTP_ID", "nhsftp"); - // hm.put("FTP_PWD", "aj9upe%DPv"); - // hm.put("FTP_PORT","15638"); - // hm.put("FTP_POS_PORT","15638"); - // hm.put("USER_HOME","/dev"); - // hm.put("FTP_USER_HOME", "/dev/CMBO") ; - // hm.put("DAY_CNT", "/dev/CMBO") ; - - hm.put("FTP_SERVER", pu.findProperty("stsys-property", "FTP_SERVER_FA")); - hm.put("FTP_SERVER2", pu.findProperty("stsys-property", "FTP_SERVER2_FA")); - hm.put("FTP_ID", pu.findProperty("stsys-property", "FTP_ID_FA")); - hm.put("FTP_PWD", pu.findProperty("stsys-property", "FTP_PWD_FA")); - hm.put("FTP_PORT",Integer.parseInt(pu.findProperty("stsys-property", "FTP_PORT_FA"))); - hm.put("FTP_POS_PORT",Integer.parseInt(pu.findProperty("stsys-property", "FTP_POS_PORT_FA"))); - hm.put("USER_HOME",pu.findProperty("stsys-property", "USER_HOME_FA")); - hm.put("FTP_USER_HOME", pu.findProperty("stsys-property", "FTP_USER_HOME_FA")) ; - hm.put("DAY_CNT", pu.findProperty("stsys-property", "DAY_CNT_FA")); - hm.put("USER_HOME_NAS",pu.findProperty("stsys-property", "USER_HOME_NAS_FA")); - -// logger.debug("[INIT] svr - " + hm.get("FTP_SERVER")); -// logger.debug("[INIT] id - " + hm.get("FTP_ID")); -// logger.debug("[INIT] pw - " + hm.get("FTP_PWD")); -// logger.debug("[INIT] port - " + hm.get("FTP_PORT")); -// logger.debug("[INIT] pport - " + hm.get("FTP_POS_PORT")); -// logger.debug("[INIT] home - " + hm.get("USER_HOME")); -// logger.debug("[INIT] fhome - " + hm.get("FTP_USER_HOME")); -// logger.debug("[INIT] NasHome - " + hm.get("USER_HOME_NAS")); - + + /*hm.put("FTP_SERVER", "211.108.6.162"); + hm.put("FTP_ID", "Nftp_nhs"); + hm.put("FTP_PWD", "L6y7V>gxU\\"); + hm.put("FTP_PORT","22"); + hm.put("FTP_POS_PORT","21"); + hm.put("USER_HOME","/home/hs_dev"); + hm.put("FTP_USER_HOME", "/data/Nftp_nhs/dev/CMBO") ; + hm.put("DAY_CNT", "/data/Nftp_nhs/dev/CMBO") ;*/ + + + hm.put("FTP_SERVER", pu.findProperty("stsys-property","FTP_SERVER_IP")); //10.0.40.148"); + hm.put("FTP_ID", pu.findProperty("stsys-property","FTP_SERVER_ID")); //"nhsftp"); + hm.put("FTP_PWD", pu.findProperty("stsys-property","FTP_SERVER_PWD")); //"aj9upe%DPv"); + hm.put("FTP_PORT",pu.findProperty("stsys-property","FTP_POS_PORT")); //"15638"); + hm.put("FTP_POS_PORT",pu.findProperty("stsys-property","FTP_POS_PORT")); //"15638"); + hm.put("USER_HOME",pu.findProperty("stsys-property","FTP_USER_HOME")); //"/home/hs_dev/files"); + //hm.put("FTP_USER_HOME", "/data/Nftp_nhs/dev/CMBO") ; + hm.put("FTP_USER_HOME", pu.findProperty("stsys-property","FTP_USER_HOME_NEW")) ; ///nas/nhs/nhs/CMBO + hm.put("FTP_USER_HOME_NEW", pu.findProperty("stsys-property","FTP_USER_HOME_NEW")); ///nas/nhs/nhs/CMBO + hm.put("FTP_USER_HOME_REAL", pu.findProperty("stsys-property","FTP_USER_HOME_REAL")); ///nas/nhs/nhs/CMBO + hm.put("DAY_CNT", pu.findProperty("stsys-property","FTP_USER_HOME_NEW")) ; + + //법인 회사별 영업일 조회 String deploy_dt = dao.getSysDate("BRKR" ,0); - logger.debug("[INIT] deploy_dt - " + deploy_dt); + //logger.debug("[INIT] deploy_dt - " + deploy_dt); //백업기간 일자는 각 파일별로 다를 수 있음 3일치? String deploy_dt2 =dao.getSysDate("BRKR" ,4); - logger.debug("[INIT] deploy_dt2 - " + deploy_dt2); + //logger.debug("[INIT] deploy_dt2 - " + deploy_dt2); //영업일 4일전부터 오늘까지 @@ -257,9 +241,16 @@ public class FileAgentPollingAction extends PollingAction { imageKindPos;// 전체 백업 저장 폴더 //5. POS total 압축폴더 --> /home/hs_dev/CMBO/TOTAL/CDP/ String positem_totzipdir =(String)hm.get("USER_HOME") + File.separator + - "CMBO" + File.separator + - "TOTAL" + File.separator + - "CDP"; + "CMBO" + File.separator + + "TOTAL" + File.separator + + "CDP"; + + //6. new folder + String nhs_zipdir = (String)hm.get("USER_HOME") + File.separator + + "CMBO" + File.separator + + "CDP" + File.separator + + imageKindPos; + // 전체 img 압축 명--> PCKR_POS_ITEM_TOTALIMG.ZIP String positem_totzipNm = cmp_cd + "_"+ sales_org_cd + "_"+ "POS_"+ imageKindPos +"_TOTALIMG.ZIP"; @@ -330,12 +321,12 @@ public class FileAgentPollingAction extends PollingAction { String basePath = (String)hm.get("USER_HOME") + File.separator + "CMBO" +"/POS/UPLOAD"; // 파일 생성 루트 - logger.debug("[INFO] basePath - " + basePath); + //logger.debug("[INFO] basePath - " + basePath); //String fileName =cmp_cd+ "_"+sales_org_cd +"_"+ imageKindPos+"_" + "0000T" + ".zip"; String fileName =cmp_cd+ "_"+sales_org_cd +"_"+ imageKindPos+"_" + dao.getFileNm(cmp_cd, deploy_dt, fileDiv) + ".zip"; - logger.debug("[INFO] fileName - " + fileName); + //logger.debug("[INFO] fileName - " + fileName); File[] filelist = new File(positem_zipMakedir).listFiles(); if (filelist.length >0) { @@ -348,69 +339,71 @@ public class FileAgentPollingAction extends PollingAction { // positem_backupimgdir : /home/hs_dev/CMBO/TOTAL/CDP/ITEM // positem_totzipdir : /home/hs_dev/CMBO/TOTAL/CDP/ //int retvalue = dao.setDirFileList(positem_zipMakedir, positem_backupimgdir); //--에러.. - - String uploadPath=(String)hm.get("FTP_USER_HOME") + "/CDP/"+imageKindPos+"/"; - - logger.debug("[INFO] uploadPath - " + uploadPath); - + + String uploadPath=(String)hm.get("FTP_USER_HOME") + "/CDP/"+imageKindPos+"/"; + String uploadViewPath = (String)hm.get("FTP_USER_HOME_REAL") + "/CDP/"+imageKindPos+"/"; + + //신규 테스트 + cu.zip(new File(positem_zipMakedir) , new File(nhs_zipdir) , "UTF-8", true ,fileName.toString()); + ArrayList ftplist = new ArrayList(); ftplist.add(fileName.toString()); - String localIp = this.getLocalServerIp(); - - logger.debug("[INFO] getLocalServerIp - " + localIp); - - String server1 = (String) hm.get("FTP_SERVER"); - String server2 = (String) hm.get("FTP_SERVER2"); - - if(localIp.equals(server1) || localIp.equals(server2)) { - - logger.debug("[INFO] local file copy start"); - - String target = (String) hm.get("USER_HOME_NAS"); - String targetUploadPath = target + "/CDP/"+imageKindPos+"/"; - - String downPath = targetUploadPath + File.separator + sftpfile.getName(); - - try { - FileInputStream fis = new FileInputStream(basePath +File.separator + fileName.toString()); - FileOutputStream fos = new FileOutputStream(downPath); - - int data = 0; - while((data=fis.read())!=-1) { - fos.write(data); - } - fis.close(); - fos.close(); - - } catch (IOException e) { - // TODO Auto-generated catch block - logger.debug("[ERROR] local file copy fail"); - } - - logger.debug("[INFO] local file copy end"); - - } else { - String port = String.valueOf(hm.get("FTP_PORT")); - JSCHFTPManager jsFtpMgr =null ; - jsFtpMgr = new JSCHFTPManager( - (String)hm.get("FTP_SERVER"), - Integer.parseInt(port) , - (String)hm.get("FTP_ID"), - (String)hm.get("FTP_PWD") - ); - - //10.당일분 upload - String downPath = uploadPath - + File.separator + sftpfile.getName(); - - logger.debug("[PROCESS] downPath - " + downPath); - - File uploadFile = new File(basePath +File.separator + fileName); - - // jsFtpMgr.upload(basePath +File.separator + fileName, remoteFile); - jsFtpMgr.upload(uploadPath, uploadFile); - } +// String localIp = this.getLocalServerIp(); +// +// logger.debug("[INFO] getLocalServerIp - " + localIp); +// +// String server1 = (String) hm.get("FTP_SERVER"); +// String server2 = (String) hm.get("FTP_SERVER2"); +// +// if(localIp.equals(server1) || localIp.equals(server2)) { +// +// logger.debug("[INFO] local file copy start"); +// +// String target = (String) hm.get("USER_HOME_NAS"); +// String targetUploadPath = target + "/CDP/"+imageKindPos+"/"; +// +// String downPath = targetUploadPath + File.separator + sftpfile.getName(); +// +// try { +// FileInputStream fis = new FileInputStream(basePath +File.separator + fileName.toString()); +// FileOutputStream fos = new FileOutputStream(downPath); +// +// int data = 0; +// while((data=fis.read())!=-1) { +// fos.write(data); +// } +// fis.close(); +// fos.close(); +// +// } catch (IOException e) { +// // TODO Auto-generated catch block +// logger.debug("[ERROR] local file copy fail"); +// } +// +// logger.debug("[INFO] local file copy end"); +// +// } else { +// String port = String.valueOf(hm.get("FTP_PORT")); +// JSCHFTPManager jsFtpMgr =null ; +// jsFtpMgr = new JSCHFTPManager( +// (String)hm.get("FTP_SERVER"), +// Integer.parseInt(port) , +// (String)hm.get("FTP_ID"), +// (String)hm.get("FTP_PWD") +// ); +// +// //10.당일분 upload +// String downPath = uploadPath +// + File.separator + sftpfile.getName(); +// +// logger.debug("[PROCESS] downPath - " + downPath); +// +// File uploadFile = new File(basePath +File.separator + fileName); +// +// // jsFtpMgr.upload(basePath +File.separator + fileName, remoteFile); +// jsFtpMgr.upload(uploadPath, uploadFile); +// } /* boolean re = sendFtpServer((String)hm.get("FTP_SERVER"), @@ -457,7 +450,7 @@ public class FileAgentPollingAction extends PollingAction { mapFile.put("SALES_ORG_CD", sales_org_cd); mapFile.put("FILE_NM", fileName); mapFile.put("STOR_CD", ""); - mapFile.put("FILE_PATH",uploadPath); + mapFile.put("FILE_PATH",uploadViewPath); //"/data/nhs_ftp/CMBO"+ "/CDP/" + imageKindPos + File.separator); mapFile.put("DEPLOY_DIV", fileDiv); //2.배신 테이블에 데이터 생성 diff --git a/src/biz/cms_NhsSysInfoRcv/NhsSysInfoDAO.java b/src/biz/cms_NhsSysInfoRcv/NhsSysInfoDAO.java index 36e4e59..2356be7 100644 --- a/src/biz/cms_NhsSysInfoRcv/NhsSysInfoDAO.java +++ b/src/biz/cms_NhsSysInfoRcv/NhsSysInfoDAO.java @@ -439,7 +439,8 @@ public class NhsSysInfoDAO extends GenericDAO { { svcId = "190423070968"; yellowId = "@happypoint"; - tempId = "2019051000017101" ;//"2019041900016501"; + //tempId = "2019051000017101" ;//"2019041900016501"; + tempId ="2019071700018544"; msgStorName =((String)hmData.get("STOR_NM")).trim(); msgTradeDate=((String)hmData.get("TRADE_DATE")).trim(); @@ -451,17 +452,37 @@ public class NhsSysInfoDAO extends GenericDAO { if(!msgPrdCount.equals("1")) msgPrdCountNm = " 외"; - msg = "■ 해피포인트 적립 내역 안내 \n\n" + - "고객님이 구매하신 상품의 해피포인트 적립 내역 안내 드립니다. \n\n" + - String.format("▶방문 매장 : %s \n",msgStorName) + - String.format("▶방문 일시 : %s \n",msgTradeDate) + - String.format("▶구매 상품 : %s %s \n",msgPrdNm ,msgPrdCountNm) + - String.format("▶적립대상 해피포인트 : %s \n",msgAfterSavePoint) + - String.format("▶적립 해피포인트 코드 : %s \n",msgBarcode) + - "▶적립대상 해피포인트 이용 방법 \n\n" + - //String.format("http://bit.ly/2Hc7ndsasd 에서 적립 해피포인트 코드 %s 를 입력하세요. \n",msgBarcode) + - "* 유의사항 : 방문 후 24시간 이내에 코드 입력하지 못하실 경우 해피포인트는 소멸됩니다. \n\n" + - "[문의] 해피포인트 고객센터 080-320-1234"; +// msg = "■ 해피포인트 적립 내역 안내 \n\n" + +// "고객님이 구매하신 상품의 해피포인트 적립 내역 안내 드립니다. \n\n" + +// String.format("▶방문 매장 : %s \n",msgStorName) + +// String.format("▶방문 일시 : %s \n",msgTradeDate) + +// String.format("▶구매 상품 : %s %s \n",msgPrdNm ,msgPrdCountNm) + +// String.format("▶적립대상 해피포인트 : %s \n",msgAfterSavePoint) + +// String.format("▶적립 해피포인트 코드 : %s \n",msgBarcode) + +// "▶적립대상 해피포인트 이용 방법 \n\n" + +// //String.format("http://bit.ly/2Hc7ndsasd 에서 적립 해피포인트 코드 %s 를 입력하세요. \n",msgBarcode) + +// "* 유의사항 : 방문 후 24시간 이내에 코드 입력하지 못하실 경우 해피포인트는 소멸됩니다. \n\n" + +// "[문의] 해피포인트 고객센터 080-320-1234"; + + msg = "■ 해피포인트 추후 적립 안내 \n\n" + + "고객님의 구매내역에 대한 해피포인트 적립 방법을 알려드립니다. \n\n" + + "▶ 구매내역 \n" + + String.format(" - 방문매장 : %s \n",msgStorName) + + String.format(" - 구매일시 : %s \n",msgTradeDate) + + String.format(" - 구매상품 : %s %s \n",msgPrdNm ,msgPrdCountNm) + + String.format(" - 결제금액 : %s원 \n\n",String.valueOf(Integer.parseInt(msgAfterSavePoint))) + + + "▶ 해피포인트 적립 안내 \n" + + " - 해피앱 로그인> 메뉴>영수증 적립> 바코드번호 직접입력 \n" + + String.format(" - 적립 코드번호: %s \n\n",msgBarcode) + + + "※ 해피앱 가입고객 경우 결제금액의 최대 5% 적립됩니다. \n" + + "(단, 할인/프로모션 제품의 경우 별도 적립률 적용) \n" + + "※ 구매 후 24시간 이내에만 적립 가능합니다. \n" + + "※ 본 메시지는 고객님께서 구매 당시 요청하셨던 휴대폰 번호로 발송되었습니다. \n\n" + + + "해피포인트 고객센터 : 080-320-1234 \n" + + "해피포인트 홈페이지 : http://bit.ly/hppoint \n" ; } phoneNo = ("82" + ((String)hmData.get("PHONE_NO")).trim().substring(1)).replace("-",""); diff --git a/xml/nhssysinq-sql.xml b/xml/nhssysinq-sql.xml index 6f71a51..1e0e327 100644 --- a/xml/nhssysinq-sql.xml +++ b/xml/nhssysinq-sql.xml @@ -69,10 +69,19 @@ diff --git a/xml/stsys-property.xml b/xml/stsys-property.xml index 83971ca..a44cecb 100644 --- a/xml/stsys-property.xml +++ b/xml/stsys-property.xml @@ -142,9 +142,19 @@ + + + + + + + + + + @@ -185,7 +195,7 @@ - +