diff --git a/src/main/java/cfs/common/util/SftpUtil.java b/src/main/java/cfs/common/util/SftpUtil.java index eb8dbf4..f283a9b 100644 --- a/src/main/java/cfs/common/util/SftpUtil.java +++ b/src/main/java/cfs/common/util/SftpUtil.java @@ -153,6 +153,40 @@ static Logger logger = Logger.getLogger(SftpUtil.class.getName()); return isResult; } + public boolean sFtpUpload2(String strDir, File file, File file2) { + + boolean isResult = true; + FileInputStream in = null; + FileInputStream in2 = null; + + try { + in = new FileInputStream(file); + in2 = new FileInputStream(file2); + if(channelSftp != null){ + channelSftp.cd(strDir); + channelSftp.put(in, file.getName()); + channelSftp.put(in2, file2.getName()); + }else{ + isResult = false; + } + } catch (SftpException e) { + isResult = false; + } catch (FileNotFoundException e) { + isResult = false; + } finally { + try { + sFtpDisConnection(); + if(in != null) + in.close(); + } catch (IOException e) { + logger.info(e); + } catch (Exception e) { + logger.info(e); + } + } + return isResult; + } + public void sFtpDisConnection() { if(channelSftp != null){ channelSftp.quit(); diff --git a/src/main/java/cfs/common/util/ZipUtil.java b/src/main/java/cfs/common/util/ZipUtil.java new file mode 100644 index 0000000..d06be4c --- /dev/null +++ b/src/main/java/cfs/common/util/ZipUtil.java @@ -0,0 +1,34 @@ +package cfs.common.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +public class ZipUtil { + + public static void makeZip(String filePath, List fileNames, String zipFileName) throws Exception { + File zipFile = new File(filePath, zipFileName); + byte[] buf = new byte[4096]; + + try(ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile))){ + for(String fileName : fileNames){ + File file = new File(filePath, fileName); + + try(FileInputStream in = new FileInputStream(file)){ + ZipEntry zf = new ZipEntry(file.getName()); + out.putNextEntry(zf); + int len = 0; + while((len = in.read(buf)) > 0){ + out.write(buf, 0, len); + } + + out.closeEntry(); + } + } + } + } + +} diff --git a/src/main/java/cfs/fine/service/impl/FinePenaltyServiceImpl.java b/src/main/java/cfs/fine/service/impl/FinePenaltyServiceImpl.java index f58e2bd..e555bd1 100644 --- a/src/main/java/cfs/fine/service/impl/FinePenaltyServiceImpl.java +++ b/src/main/java/cfs/fine/service/impl/FinePenaltyServiceImpl.java @@ -11,6 +11,10 @@ import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; @@ -24,6 +28,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cfs.common.dao.CodeInfoDao; @@ -31,11 +36,14 @@ import cfs.common.service.CfsCommonService; import cfs.common.util.HttpUtil; import cfs.common.util.ObjectUtil; import cfs.common.util.Result; +import cfs.common.util.SftpUtil; import cfs.common.util.StringUtil; +import cfs.common.util.ZipUtil; import cfs.common.vo.ParamBean; import cfs.fine.dao.FinePenaltyDao; import cfs.fine.service.FinePenaltyService; import cfs.fine.vo.PenaltyParamVO; +import cfs.trsmrcv.dao.TrsmrcvDao; @SuppressWarnings({ "rawtypes", "unchecked" }) @Service("finePenaltyService") @@ -51,6 +59,12 @@ public class FinePenaltyServiceImpl implements FinePenaltyService { @Resource(name="cfsCommonService") private CfsCommonService cfsCommonService; + @Resource(name="trsmrcvDao") + private TrsmrcvDao trsmrcvDao; + + @Autowired + private SftpUtil sftpUtil; + @Override public List findPenaltyList(PenaltyParamVO param) throws Exception { return finePenaltyDao.findPenaltyList(param); @@ -3107,11 +3121,34 @@ public class FinePenaltyServiceImpl implements FinePenaltyService { txtImage += "P11110"+param.getPenaltyManageYear()+String.format("%06d", Integer.parseInt(param.getPenaltySeqno()))+"A.JPG" + "\n"; - String line = conOrg+ "|" + conRCEPTID+ "|" + dataCd+ "|" + divKb + "|" + dfpayYn+ "|" + rcptKb+ "|" - + sealCd+ "|" + wordKb+ "|" + mailCnt+ "|" + recevCnt+ "|" + envCd+ "|" + colorYn+ "|" - + MM_YN+ "|" + FLEX_CD+ "|" + DM_CNT+ "|" + SB_FG+ "|" + APVL_NB+ "|" + SEND_DATE+ "|" - + SEND_TIME+ "|" + CON_KEY+ "|" + RELORSECT_CD+ "|" + CON_DATA+ "|" + SENDER_NM+ "|" - + SENDER_ZIPCODE+ "|" + SENDER_ADDR+ "|" + SENDER_DTAILADDR+ "|" + SENDER_DATA+ "|" + String line = + conOrg+ "|" + + conRCEPTID+ "|" + + dataCd+ "|" + + divKb + "|" + + dfpayYn+ "|" + + rcptKb+ "|" + + sealCd+ "|" + + wordKb+ "|" + + mailCnt+ "|" + + recevCnt+ "|" + + envCd+ "|" + + colorYn+ "|" + + MM_YN+ "|" + + FLEX_CD+ "|" + + DM_CNT+ "|" + + SB_FG+ "|" + + APVL_NB+ "|" + + SEND_DATE+ "|" + + SEND_TIME+ "|" + + CON_KEY+ "|" //20번째항목 + + RELORSECT_CD+ "|" + + CON_DATA+ "|" + + SENDER_NM+ "|" + + SENDER_ZIPCODE+ "|" + + SENDER_ADDR+ "|" + + SENDER_DTAILADDR+ "|" + + SENDER_DATA+ "|" //27번째항목 + SQL_CNT+ "|" + RECEV_NM+ "|" + RECEV_ZIPCODE+ "|" + RECEV_ADDR+ "|" + RECEV_DTAILADDR+ "|" + RGST_NMBR+ "|" + RECEV_DATA+ "|" + TEL_NUMBER1+ "|" + TEL_NUMBER2+ "|" + TEL_NUMBER3+ "|" + PHONE_NUMBER1+ "|" + PHONE_NUMBER2+ "|" + PHONE_NUMBER3+ "|" + RETURN_NM+ "|" + RETURN_ZIPCODE+ "|" @@ -3122,7 +3159,9 @@ public class FinePenaltyServiceImpl implements FinePenaltyService { + RECEV_RENTAL_MANUAL+ "|" + RECEV_RENTAL_PRINTTYPE+ "|" + RECEV_RENTAL_JNO+ "|" + RECEV_LAW_INFO+ "|" + RECEV_RECALL_TEL+ "|" + RECEV_JANAP_TEL+ "|" + RECEV_NAPBU_INFO+ "|"+RECEV_RECALL_USEGIGAN_INFO+ "|" + RECEV_MM_CODE_1+ "|" + RECEV_PO_CODE_1+ "|" + RECEV_BARCODE1D_1+ "|" + RECEV_BARCODE2D_1+ "|" + RECEV_INGB2_1+ "|" - + RECEV_CARNO_1+ "|" + RECEV_WDATETIME_1+ "|" + RECEV_DONG_1+ "|" + RECEV_POS_1+ "|" + RECEV_VIOR_1+ "|" + + RECEV_CARNO_1+ "|" + + RECEV_WDATETIME_1+ "|" + + RECEV_DONG_1+ "|" + RECEV_POS_1+ "|" + RECEV_VIOR_1+ "|" + RECEV_CARKIND_1+ "|" + RECEV_CARID_1+ "|" + RECEV_MOSAICX_1+ "|" + RECEV_MOSAICY_1+ "|" + RECEV_IMGCNT_1+ "|" + RECEV_TWOHOUR_1+ "|" + RECEV_SCHOOL_1+ "|" + RECEV_BASICLIVE_1+ "|" + RECEV_POST_GB_1+ "|" + RECEV_PRINTDATE_1+ "|" + RECEV_GOJINUMBER_1+ "|" + RECEV_ORG_AMT_1+ "|" + RECEV_KEUMINFO_1+ "|" @@ -3139,15 +3178,19 @@ public class FinePenaltyServiceImpl implements FinePenaltyService { } - findCreateImageFileList(txt,fileFullName); + this.findCreateImageFileList(txt,fileFullName); - findCreateImageFileList(txtImage,cfsCommonService.findCommonSecureGet("FIlE_PATH")+CON_KEY+"img.txt"); + this.findCreateImageFileList(txtImage,cfsCommonService.findCommonSecureGet("FIlE_PATH")+CON_KEY+"img.txt"); - findCreateImageUpload(paramList); + this.findCreateImageUpload(paramList); + String command = String.format("sh "+"/gpta/source-app/cfs/egreen/snd_eGreen.sh "+"/gpta/source-app/cfs/egreen"+" "+CON_KEY); shellCmd(command); + //String path = this.egreen_step4("/gpta/source-app/cfs/egreen", CON_KEY); + //this.egreen_step5(path); + }catch(RuntimeException e) { e.printStackTrace(); logger.info("catch check"); @@ -3158,28 +3201,93 @@ public class FinePenaltyServiceImpl implements FinePenaltyService { } public void findCreateImageFileList(String txt, String fileName) throws Exception { - System.out.println(txt); - System.out.println(fileName); - System.out.println("**==================================="); + BufferedWriter bf = new BufferedWriter(new FileWriter(fileName)); try{ bf.write(txt); bf.flush(); - logger.info("무사 성공났다"+fileName); + }catch(RuntimeException e) { e.printStackTrace(); - logger.info("catch check"); + }catch(Exception e){ e.printStackTrace(); - logger.info("catch check"); + }finally{ if(bf != null) bf.close(); } } + private String egreen_step4(String rootWork, String conkey) throws Exception { + String result = ""; + + String chg_files_path = rootWork+"/data"; + + String readLineFileName_SUFFIX = "img.txt"; + String chg_file_name_PREFIX = "LGRDFB$"; + + String readLineFileName = conkey+readLineFileName_SUFFIX; + String readLineFilePath = rootWork+"/"+readLineFileName; + + String firstTxtName = conkey+".txt"; + String firstTxtPath = rootWork+"/"+firstTxtName; + String firstZipName = conkey+".zip"; + String firstZipPath = rootWork+"/"+firstZipName; + + String chg_file_name_no_ext = chg_file_name_PREFIX+conkey; + String chg_file_name_txt = chg_file_name_no_ext+".txt"; + String chg_file_path_txt = chg_files_path+"/"+chg_file_name_txt; + String chg_file_name_zip = chg_file_name_no_ext+".zip"; + String chg_file_path_zip = chg_files_path+"/"+chg_file_name_zip; + + Files.move(Paths.get(firstTxtPath), Paths.get(chg_file_path_txt), StandardCopyOption.REPLACE_EXISTING); + + BufferedReader br = Files.newBufferedReader(Paths.get(readLineFilePath)); + Charset.forName("UTF-8"); + List lines = new ArrayList(); + String line = ""; + while ((line = br.readLine()) != null) { + if(line != null && !line.equals("")){ + lines.add(line); + } + } + + ZipUtil.makeZip(rootWork, lines, firstZipName); + + for(String one : lines){ + Files.delete(Paths.get(rootWork+"/"+one)); + } + Files.delete(Paths.get(readLineFilePath)); + + + Files.move(Paths.get(firstZipPath), Paths.get(chg_file_path_zip), StandardCopyOption.REPLACE_EXISTING); + + + result = chg_files_path + "/" + chg_file_name_no_ext; + + return result; + } + + private boolean egreen_step5(String path){ + Map connectionInfo = trsmrcvDao.selectConnectionInfo("EGREEN_ESB_AGENT_FTP"); + + boolean initResult = sftpUtil.init( + connectionInfo.get("CONNECT_IP"), + connectionInfo.get("USER_ID"), + connectionInfo.get("USER_PASS"), + Integer.parseInt(connectionInfo.get("CONNECT_PORT")) + ); + if(!initResult){ + return false; + } + + boolean uploadResult = sftpUtil.sFtpUpload2(connectionInfo.get("PATH_INFO"), new File(path+".txt"), new File(path+".zip")); + + return uploadResult; + } private boolean shellCmd(String cmd) { Process process = null; diff --git a/src/main/java/cfs/input/service/impl/InputAfterServiceImpl.java b/src/main/java/cfs/input/service/impl/InputAfterServiceImpl.java index 0b0ac18..7f0defc 100644 --- a/src/main/java/cfs/input/service/impl/InputAfterServiceImpl.java +++ b/src/main/java/cfs/input/service/impl/InputAfterServiceImpl.java @@ -11,6 +11,10 @@ import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -22,17 +26,21 @@ import javax.imageio.ImageIO; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import cfs.common.dao.CodeInfoDao; import cfs.common.service.CfsCommonService; import cfs.common.util.HttpUtil; +import cfs.common.util.SftpUtil; import cfs.common.util.StringUtil; +import cfs.common.util.ZipUtil; import cfs.fine.dao.FinePenaltyDao; import cfs.fine.vo.PenaltyParamVO; import cfs.input.dao.InputAfterDao; import cfs.input.service.InputAfterService; import cfs.input.vo.InputAfterVO; +import cfs.trsmrcv.dao.TrsmrcvDao; @Service("inputAfterService") public class InputAfterServiceImpl implements InputAfterService { @@ -51,7 +59,11 @@ public class InputAfterServiceImpl implements InputAfterService { @Resource(name = "codeInfoDao") private CodeInfoDao codeInfoDao; + @Resource(name="trsmrcvDao") + private TrsmrcvDao trsmrcvDao; + @Autowired + private SftpUtil sftpUtil; @Override public List findAfterPay(InputAfterVO param) throws Exception { @@ -471,18 +483,18 @@ public class InputAfterServiceImpl implements InputAfterService { txt += line; } - findCreateImageFileList(txt, fileFullName); - - + this.findCreateImageFileList(txt, fileFullName); - findCreateImageFileList(txtImage,cfsCommonService.findCommonSecureGet("FIlE_PATH")+CON_KEY+"img.txt"); + this.findCreateImageFileList(txtImage,cfsCommonService.findCommonSecureGet("FIlE_PATH")+CON_KEY+"img.txt"); - findCreateImageUpload(paramList); + this.findCreateImageUpload(paramList); String command = String.format("sh "+"/gpta/source-app/cfs/egreen/snd_eGreen.sh "+"/gpta/source-app/cfs/egreen"+" "+CON_KEY); shellCmd(command); - + //String path = this.egreen_step4("/gpta/source-app/cfs/egreen", CON_KEY); + //this.egreen_step5(path); + }catch(RuntimeException e) { e.printStackTrace(); logger.info("catch check"); @@ -510,6 +522,74 @@ public class InputAfterServiceImpl implements InputAfterService { } } + private String egreen_step4(String rootWork, String conkey) throws Exception { + String result = ""; + + String chg_files_path = rootWork+"/data"; + + String readLineFileName_SUFFIX = "img.txt"; + String chg_file_name_PREFIX = "LGRDFB$"; + + String readLineFileName = conkey+readLineFileName_SUFFIX; + String readLineFilePath = rootWork+"/"+readLineFileName; + + String firstTxtName = conkey+".txt"; + String firstTxtPath = rootWork+"/"+firstTxtName; + String firstZipName = conkey+".zip"; + String firstZipPath = rootWork+"/"+firstZipName; + + String chg_file_name_no_ext = chg_file_name_PREFIX+conkey; + String chg_file_name_txt = chg_file_name_no_ext+".txt"; + String chg_file_path_txt = chg_files_path+"/"+chg_file_name_txt; + String chg_file_name_zip = chg_file_name_no_ext+".zip"; + String chg_file_path_zip = chg_files_path+"/"+chg_file_name_zip; + + Files.move(Paths.get(firstTxtPath), Paths.get(chg_file_path_txt), StandardCopyOption.REPLACE_EXISTING); + + BufferedReader br = Files.newBufferedReader(Paths.get(readLineFilePath)); + Charset.forName("UTF-8"); + List lines = new ArrayList(); + String line = ""; + while ((line = br.readLine()) != null) { + if(line != null && !line.equals("")){ + lines.add(line); + } + } + + ZipUtil.makeZip(rootWork, lines, firstZipName); + + for(String one : lines){ + Files.delete(Paths.get(rootWork+"/"+one)); + } + Files.delete(Paths.get(readLineFilePath)); + + + Files.move(Paths.get(firstZipPath), Paths.get(chg_file_path_zip), StandardCopyOption.REPLACE_EXISTING); + + + result = chg_files_path + "/" + chg_file_name_no_ext; + + return result; + } + + private boolean egreen_step5(String path){ + Map connectionInfo = trsmrcvDao.selectConnectionInfo("EGREEN_ESB_AGENT_FTP"); + + boolean initResult = sftpUtil.init( + connectionInfo.get("CONNECT_IP"), + connectionInfo.get("USER_ID"), + connectionInfo.get("USER_PASS"), + Integer.parseInt(connectionInfo.get("CONNECT_PORT")) + ); + if(!initResult){ + return false; + } + + boolean uploadResult = sftpUtil.sFtpUpload2(connectionInfo.get("PATH_INFO"), new File(path+".txt"), new File(path+".zip")); + + return uploadResult; + } + private boolean shellCmd(String cmd) { Process process = null; Runtime runtime = Runtime.getRuntime(); diff --git a/src/main/java/cfs/trsmrcv/web/TestController.java b/src/main/java/cfs/trsmrcv/web/TestController.java index fcd434b..fc2284f 100644 --- a/src/main/java/cfs/trsmrcv/web/TestController.java +++ b/src/main/java/cfs/trsmrcv/web/TestController.java @@ -5,6 +5,10 @@ import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.util.ArrayList; @@ -35,6 +39,7 @@ import cfs.common.util.FtpUtil; import cfs.common.util.Result; import cfs.common.util.ResultSmartPlatform; import cfs.common.util.SftpUtil; +import cfs.common.util.ZipUtil; import cfs.schd.dao.SchdDao; import cfs.trsmrcv.dao.TrsmrcvDao; @@ -49,6 +54,7 @@ public class TestController { @Resource(name = "schdDao") private SchdDao schdDao; + @Autowired private FtpUtil ftpUtil; @Autowired @@ -199,6 +205,74 @@ public class TestController { } + private String egreen_step4(String rootWork, String conkey) throws Exception { + String result = ""; + + String chg_files_path = rootWork+"/data"; + + String readLineFileName_SUFFIX = "img.txt"; + String chg_file_name_PREFIX = "LGRDFB$"; + + String readLineFileName = conkey+readLineFileName_SUFFIX; + String readLineFilePath = rootWork+"/"+readLineFileName; + + String firstTxtName = conkey+".txt"; + String firstTxtPath = rootWork+"/"+firstTxtName; + String firstZipName = conkey+".zip"; + String firstZipPath = rootWork+"/"+firstZipName; + + String chg_file_name_no_ext = chg_file_name_PREFIX+conkey; + String chg_file_name_txt = chg_file_name_no_ext+".txt"; + String chg_file_path_txt = chg_files_path+"/"+chg_file_name_txt; + String chg_file_name_zip = chg_file_name_no_ext+".zip"; + String chg_file_path_zip = chg_files_path+"/"+chg_file_name_zip; + + Files.move(Paths.get(firstTxtPath), Paths.get(chg_file_path_txt), StandardCopyOption.REPLACE_EXISTING); + + BufferedReader br = Files.newBufferedReader(Paths.get(readLineFilePath)); + Charset.forName("UTF-8"); + List lines = new ArrayList(); + String line = ""; + while ((line = br.readLine()) != null) { + if(line != null && !line.equals("")){ + lines.add(line); + } + } + + ZipUtil.makeZip(rootWork, lines, firstZipName); + + for(String one : lines){ + Files.delete(Paths.get(rootWork+"/"+one)); + } + Files.delete(Paths.get(readLineFilePath)); + + + Files.move(Paths.get(firstZipPath), Paths.get(chg_file_path_zip), StandardCopyOption.REPLACE_EXISTING); + + + result = chg_files_path + "/" + chg_file_name_no_ext; + + return result; + } + + private boolean egreen_step5(String path){ + Map connectionInfo = trsmrcvDao.selectConnectionInfo("EGREEN_ESB_AGENT_FTP"); + + boolean initResult = sftpUtil.init( + connectionInfo.get("CONNECT_IP"), + connectionInfo.get("USER_ID"), + connectionInfo.get("USER_PASS"), + Integer.parseInt(connectionInfo.get("CONNECT_PORT")) + ); + if(!initResult){ + return false; + } + + boolean uploadResult = sftpUtil.sFtpUpload2(connectionInfo.get("PATH_INFO"), new File(path+".txt"), new File(path+".zip")); + + return uploadResult; + } + private boolean shellCmd(String cmd) { Process process = null; Runtime runtime = Runtime.getRuntime(); @@ -283,6 +357,7 @@ public class TestController { return result.getResult(); } + //빈파일 업로드 @RequestMapping(value="/cfs/trsmrcv/sftpUtest.do", method=RequestMethod.GET) public @ResponseBody Map sftpUtest(HttpServletRequest request) throws Exception { ResultSmartPlatform result = new ResultSmartPlatform(); @@ -302,11 +377,60 @@ public class TestController { return result.getResult(); } - File file = new File("test.txt"); + File file = new File("/gpta/source-app/cfs/egreen/data/test2.txt"); if(!file.exists()){ file.createNewFile(); } - boolean uResult = sftpUtil.sFtpUpload(connectionInfo.get("PATH_INFO"), file); + boolean uResult = sftpUtil.sFtpUpload("ESB_AGENT/FILE/SEND/CG144523401150/", file); + if(!uResult){ + result.setErrorMsg(Result.STATUS_ERROR, "이그린 연계 서버 업로드 오류가 발생하였습니다."); + return result.getResult(); + } + + result.setMsg(ResultSmartPlatform.STATUS_SUCESS, "정상적으로 처리되었습니다."); + return result.getResult(); + } + + //압축파일 생성 + @RequestMapping(value="/cfs/trsmrcv/sftpUtest2.do", method=RequestMethod.GET) + public @ResponseBody Map sftpUtest2(HttpServletRequest request) throws Exception { + ResultSmartPlatform result = new ResultSmartPlatform(); + + + String path = this.egreen_step4("/gpta/source-app/cfs/egreen","NS0000000000000"); + + result.setData("pathStr", path); + result.setMsg(ResultSmartPlatform.STATUS_SUCESS, "정상적으로 처리되었습니다."); + return result.getResult(); + } + + //임의경로 보내기 + @RequestMapping(value="/cfs/trsmrcv/sftpUtest3.do", method=RequestMethod.GET) + public @ResponseBody Map sftpUtest3(HttpServletRequest request) throws Exception { + ResultSmartPlatform result = new ResultSmartPlatform(); + + + Map connectionInfo = trsmrcvDao.selectConnectionInfo("EGREEN_ESB_AGENT_FTP"); + + boolean initResult = sftpUtil.init( + connectionInfo.get("CONNECT_IP"), + connectionInfo.get("USER_ID"), + connectionInfo.get("USER_PASS"), + Integer.parseInt(connectionInfo.get("CONNECT_PORT")) + ); + + if(!initResult){ + result.setErrorMsg(Result.STATUS_ERROR, "이그린 연계 서버 연결 오류가 발생하였습니다."); + return result.getResult(); + } + + File file = new File("/gpta/source-app/cfs/egreen/data/LGRDFB$NS0000000000000.txt"); + File file2 = new File("/gpta/source-app/cfs/egreen/data/LGRDFB$NS0000000000000.zip"); + if(!file.exists() || !file2.exists()){ + result.setErrorMsg(Result.STATUS_ERROR, "이그린 연계 서버 업로드 오류가 발생하였습니다."); + return result.getResult(); + } + boolean uResult = sftpUtil.sFtpUpload2("ESB_AGENT/FILE/SEND/", file, file2); if(!uResult){ result.setErrorMsg(Result.STATUS_ERROR, "이그린 연계 서버 업로드 오류가 발생하였습니다."); return result.getResult(); @@ -318,6 +442,8 @@ public class TestController { + + @RequestMapping(value="/cfs/trsmrcv/seoulsmstest.do", method=RequestMethod.GET) public @ResponseBody Map seoulsmstest(HttpServletRequest request) throws Exception { ResultSmartPlatform result = new ResultSmartPlatform();