From 60ac1e756080a757c79172279c7a6c7589dcf0ad Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Mon, 5 Jun 2023 14:07:34 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/biz/cmm/dao/XitTestMapper.java | 55 --- .../biz/cmm/service/XitTest2Service.java | 23 - .../biz/cmm/service/XitTestService.java | 59 --- .../cmm/service/bean/XitTest2ServiceBean.java | 35 -- .../cmm/service/bean/XitTestServiceBean.java | 214 -------- .../biz/cmm/web/XitTestController.java | 467 ------------------ .../biz/util/ExtnlInterfaceUtils.java | 14 - .../framework/cmm/XitTest-mysql-mapper.xml | 35 -- 8 files changed, 902 deletions(-) delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/dao/XitTestMapper.java delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTest2Service.java delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTestService.java delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTest2ServiceBean.java delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTestServiceBean.java delete mode 100644 src/main/java/kr/xit/fims/framework/biz/cmm/web/XitTestController.java delete mode 100644 src/main/resources/sql/mapper/framework/cmm/XitTest-mysql-mapper.xml diff --git a/src/main/java/kr/xit/fims/framework/biz/cmm/dao/XitTestMapper.java b/src/main/java/kr/xit/fims/framework/biz/cmm/dao/XitTestMapper.java deleted file mode 100644 index 936b1a7e..00000000 --- a/src/main/java/kr/xit/fims/framework/biz/cmm/dao/XitTestMapper.java +++ /dev/null @@ -1,55 +0,0 @@ -package kr.xit.fims.framework.biz.cmm.dao; - -import kr.xit.fims.framework.core.utils.XitMap; -import org.egovframe.rte.psl.dataaccess.mapper.Mapper; - -import java.sql.SQLException; -import java.util.List; -import java.util.Map; - -@Mapper -public interface XitTestMapper { - - - /** - *
메소드 설명: 조회 테스트
- * @return XitMap 요청처리 후 응답객체 - * @throws SQLException XitMap 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 18. - */ - public XitMap findTest() throws SQLException; - public XitMap findTest(String param) throws SQLException; - - /** - *
메소드 설명: 등록 테스트
- * @return - * @throws SQLException int 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - public int addTest() throws SQLException; - public int addTest(String error_code) throws SQLException; - public int addTest(Map param) throws SQLException; - - /** - *
메소드 설명: 등록 테스트
-	 * 	-n개의 단위로 insert를 수행 한다.
-	 * 
- * @param listParam - * @return - * @throws SQLException int 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - public int addListTest(List> listParam) throws SQLException; - - /** - *
메소드 설명: 접속로그 테이블의 테스트 데이터 일괄 삭제
- * @param param - * @return int 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - public int removesXitConectLogForTestData(Map param); -} diff --git a/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTest2Service.java b/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTest2Service.java deleted file mode 100644 index 6027392c..00000000 --- a/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTest2Service.java +++ /dev/null @@ -1,23 +0,0 @@ -package kr.xit.fims.framework.biz.cmm.service; - -/** - * - * @업무그룹명: XIT프레임워크 테스트 Service - * @설명: 테스트를 위한 서비스를 기술 한다. - * @최초작성일: 2020. 3. 18. 오후 6:13:48 - * @최초작성자: 박민규 - * @author (주)엑스아이티 개발팀 - * @since 2002. 2. 2. - * @version 1.0 Copyright(c) XIT All rights reserved. - */ -public interface XitTest2Service { - - - /** - *
메소드 설명: 연쇄적 서비스 호출 시 트랜잭션 테스트
- * void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - public void transactionOfServiceChainTest(); -} diff --git a/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTestService.java b/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTestService.java deleted file mode 100644 index f207c86e..00000000 --- a/src/main/java/kr/xit/fims/framework/biz/cmm/service/XitTestService.java +++ /dev/null @@ -1,59 +0,0 @@ -package kr.xit.fims.framework.biz.cmm.service; - -import kr.xit.fims.framework.core.utils.XitMap; - -/** - * - * @업무그룹명: XIT프레임워크 테스트 Service - * @설명: 테스트를 위한 서비스를 기술 한다. - * @최초작성일: 2020. 3. 18. 오후 6:13:48 - * @최초작성자: 박민규 - * @author (주)엑스아이티 개발팀 - * @since 2002. 2. 2. - * @version 1.0 Copyright(c) XIT All rights reserved. - */ -public interface XitTestService { - - /** - *
메소드 설명: 조회 테스트
- * @return XitMap 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 18. - */ - public XitMap findTest(); - - - /** - *
메소드 설명: 트랜잭션 테스트
- * void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - public void transactionTest(); - - /** - *
메소드 설명: 연쇄적 서비스 호출 시 트랜잭션 테스트
- * void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - public void transactionOfServiceChainTest(); - - - /** - *
메소드 설명: 배치등록 테스트
- * @return int 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - public int insertBatchTestBySingle(int dataSize); - /** - *
메소드 설명: 배치등록 테스트
-	 * 	-n개의 단위로 insert를 수행 한다.
-	 * 
- * @return int 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - public int insertBatchTestByBulk(int dataSize); -} diff --git a/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTest2ServiceBean.java b/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTest2ServiceBean.java deleted file mode 100644 index c4dc014f..00000000 --- a/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTest2ServiceBean.java +++ /dev/null @@ -1,35 +0,0 @@ -package kr.xit.fims.framework.biz.cmm.service.bean; - -import cokr.xit.foundation.component.AbstractServiceBean; -import kr.xit.fims.framework.biz.cmm.dao.XitTestMapper; -import kr.xit.fims.framework.biz.cmm.service.XitTest2Service; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.sql.SQLException; - -@Service -public class XitTest2ServiceBean extends AbstractServiceBean implements XitTest2Service{ - - @Resource - private XitTestMapper xitTestMapper; - - @Override - public void transactionOfServiceChainTest() { - /** - * DB 등록 - */ - try { - xitTestMapper.addTest("22"); - } catch (SQLException e) { - throw new RuntimeException("DB Insert FAIL", e); - } - - - /** - * error 발생 - */ - Integer.parseInt(null); - - } -} diff --git a/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTestServiceBean.java b/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTestServiceBean.java deleted file mode 100644 index 868e857e..00000000 --- a/src/main/java/kr/xit/fims/framework/biz/cmm/service/bean/XitTestServiceBean.java +++ /dev/null @@ -1,214 +0,0 @@ -package kr.xit.fims.framework.biz.cmm.service.bean; - -import cokr.xit.foundation.component.AbstractServiceBean; -import kr.xit.fims.framework.biz.cmm.dao.XitTestMapper; -import kr.xit.fims.framework.biz.cmm.service.XitTest2Service; -import kr.xit.fims.framework.biz.cmm.service.XitTestService; -import kr.xit.fims.framework.core.utils.XitMap; -import org.apache.ibatis.session.ExecutorType; -import org.apache.ibatis.session.SqlSession; -import org.apache.ibatis.session.SqlSessionFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class XitTestServiceBean extends AbstractServiceBean implements XitTestService{ - - @Resource - private XitTestMapper xitTestMapper; - @Resource - private XitTest2Service xitTest2Service; - @Autowired - private SqlSessionFactory sqlSessionFactory; - - @Override - public XitMap findTest() { - XitMap result = new XitMap(); - try { - result = xitTestMapper.findTest(); - result = xitTestMapper.findTest("1"); - } catch (SQLException e) { - throw new RuntimeException("DB 조회 테스트 FAIL"); - } - - return result; - } - - @Override - public void transactionTest() { - /** - * DB 등록 - */ - try { - xitTestMapper.addTest("00"); - xitTestMapper.addTest("11"); - } catch (SQLException e) { - throw new RuntimeException("DB Insert FAIL", e); - } - - - /** - * error 발생 - */ - String str = null; - str.toString(); - - - } - - @Override - public void transactionOfServiceChainTest() { - /** - * DB 등록 - */ - try { - xitTestMapper.addTest("00"); - } catch (SQLException e) { - throw new RuntimeException("DB Insert FAIL", e); - } - - - /** - * 서비스 모듈 호출 - */ - xitTest2Service.transactionOfServiceChainTest(); - - } - - @Override - public int insertBatchTestBySingle(int dataSize) { - final int BATCH_SIZE = 1000; //SQL 실행 단위 - final boolean AUTO_COMMIT = true; //Auto Commit 여부. 2021.01.17 박민규- Spring Transaction 설정된 환경에서 true/false 차이 없음. Service 호출 시 Transaction Open... 동일하게 동작 함. - List> list = this.creatTestDataList(dataSize); //테스트 데이터 생성 - - //테스트 데이터 삭제 - xitTestMapper.removesXitConectLogForTestData(null); - - //open - //SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, AUTO_COMMIT); - // - //long startTime = System.currentTimeMillis(); - //for(int i=0; i param = list.get(i); - // - // //load - // sqlSession.insert("framework.xit.category.common.dao.XitTestMapper.addTest", param); - // if((i+1)%BATCH_SIZE == 0) { - // //execute - // sqlSession.flushStatements(); - // } - //} - //long endTime = System.currentTimeMillis(); - ////execute - //sqlSession.flushStatements(); - ////close - //sqlSession.close(); - //System.out.println("==============================================="); - //System.out.println(String.format("일괄등록 테스트[총 %d건 처리소요 %d초]", list.size(), (endTime-startTime)/1000 )); - //System.out.println("==============================================="); - - try(SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, AUTO_COMMIT)){ - - long startTime = System.currentTimeMillis(); - for(int i=0; i param = list.get(i); - - //load - sqlSession.insert("kr.xit.fims.framework.biz.cmm.dao.XitTestMapper.addTest", param); - if((i+1)%BATCH_SIZE == 0) { - //execute - sqlSession.flushStatements(); - } - } - long endTime = System.currentTimeMillis(); - //execute - sqlSession.flushStatements(); - System.out.println("==============================================="); - System.out.println(String.format("일괄등록 테스트[총 %d건 처리소요 %d초]", list.size(), (endTime-startTime)/1000 )); - System.out.println("==============================================="); - } - - return list.size(); - } - - @Override - public int insertBatchTestByBulk(int dataSize) { - final int BATCH_SIZE = 1000; //SQL 실행 단위 - final boolean AUTO_COMMIT = true; //Auto Commit 여부. 2021.01.17 박민규- Spring Transaction 설정된 환경에서 true/false 차이 없음. Service 호출 시 Transaction Open... 동일하게 동작 함. - List> list = this.creatTestDataList(dataSize); //테스트 데이터 생성 - - //테스트 데이터 삭제 - xitTestMapper.removesXitConectLogForTestData(null); - - //open - SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, AUTO_COMMIT); - - long startTime = System.currentTimeMillis(); - List> listParam = new ArrayList>(); - for(int i=0; i param = list.get(i); - listParam.add(param); - - if(listParam.size()%BATCH_SIZE == 0) { - //load - sqlSession.insert("kr.xit.fims.framework.biz.cmm.dao.XitTestMapper.addListTest", listParam); - - listParam.clear(); - } - } - if(listParam.size()>0) { //미처리 건수가 있다면.. - //load - sqlSession.insert("kr.xit.fims.framework.biz.cmm.dao.XitTestMapper.addListTest", listParam); - } - - long endTime = System.currentTimeMillis(); - //execute - sqlSession.flushStatements(); - //close - sqlSession.close(); - System.out.println("==============================================="); - System.out.println(String.format("일괄등록 테스트[총 %d건 처리소요 %d초]", list.size(), (endTime-startTime)/1000 )); - System.out.println("==============================================="); - - - return list.size(); - } - - /** - *
메소드 설명: 대용량 데이터 생성
- * @return List> 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - private List> creatTestDataList(int dataSize) { - List> listParam = new ArrayList>(); - - if(dataSize<1) - dataSize = 100999; - for(int i=0; i param = new HashMap(); - param.put("log_id", "BATCH_"+lpad(i+"", 10, '0')); - param.put("error_code", "00"); - listParam.add(param); - } - - return listParam; - } - - private String lpad(String val, int size, char charcter) { - - StringBuffer sb = new StringBuffer(); - for(int i=0; i메소드 설명: 조회 테스트 - * -DB가 정상적으로 호출 되는지 확인 한다. - * - * void 요청처리 후 응답객체 - * @author: 박민규 - * @throws IOException - * @date: 2020. 3. 18. - */ - @RequestMapping(name = "", value="case1") - public void case1(HttpServletResponse resp) throws IOException { - Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); - if (!isAuthenticated) { -// model.addAttribute("message", egovMessageSource.getMessage("fail.common.login")); -// return "framework/egov/uat/uia/EgovLoginUsr"; - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
권한이 없습니다.
")); - writer.write("================================================================"); - writer.close(); - return; - } - - /** - * 처리 - */ - //DB 조회 - XitMap xitMap = xitTestService.findTest(); - - - /** - * 요청결과 반화 - */ - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
조회 테스트 결과:::::::%s
", xitMap.toString())); - writer.write("================================================================"); - writer.close(); - - } - - - /** - *
메소드 설명: 트랜잭션 테스트
- * @param resp - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - @RequestMapping(name = "", value="case2") - public void case2(HttpServletResponse resp) throws IOException { - Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); - if (!isAuthenticated) { - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
권한이 없습니다.
")); - writer.write("================================================================"); - writer.close(); - return; - } - - -// try { - xitTestService.transactionTest(); -// } catch (Exception e) { -// resp.setCharacterEncoding("UTF-8"); -// resp.setContentType("text/html charset=UTF-8"); -// Writer writer = resp.getWriter(); -// writer.write("================================================================"); -// writer.write(String.format("
처리 도중 error 발생.
")); -// writer.write(String.format("
error details...-> %s
", e.getMessage())); -// writer.write("================================================================"); -// writer.close(); -// } - } - - - /** - *
메소드 설명: 연쇄적인 서비스 호출 시 트랜잭션 테스트
- * @param resp - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - @RequestMapping(name = "", value="case3") - public void case3(HttpServletResponse resp) throws IOException { - Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); - if (!isAuthenticated) { - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
권한이 없습니다.
")); - writer.write("================================================================"); - writer.close(); - return; - } - - - try { - xitTestService.transactionOfServiceChainTest(); - } catch (Exception e) { - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
처리 도중 error 발생.
")); - writer.write(String.format("
error details...-> %s
", e.getMessage())); - writer.write("================================================================"); - writer.close(); - - throw new RuntimeException(e); - } - } - - /** - *
메소드 설명: tiles 적용 테스트
- * @param resp - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 3. 20. - */ - @RequestMapping(name = "", value="case4") - public String case4(@RequestParam(name="tiles", required=false, defaultValue="") String tiles) throws IOException { - switch (tiles.toUpperCase()) { - case "N": - return TEST_JSP_PATH+"test"+TILES_TYPE.NONE.getVal(); - default: - return TEST_JSP_PATH+"test"; - } - - } - - /** - *
메소드 설명: 사용자 비밀번호 초기화
-	 * 	-신규시스템으로 이전된 사용자의 비밀번호를 새로운 비밀번호로 변경 한다.
-	 * 
- * @param resp - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 4. 29. - */ - @RequestMapping(name = "", value="case5") - public void case5(HttpServletResponse resp - , @RequestParam(name="trget", required=false, defaultValue="one") String trget - , @RequestParam(name="trgetId", required=false, defaultValue="") String trgetId - ) throws IOException { - - - List listUserInfo = null; - try { - XitUserInfoVO vo = new XitUserInfoVO(); - if("all".equalsIgnoreCase(trget)) - listUserInfo = xitFrameCrudService.findXitUserInfos(vo); - else { - if(XitCmmnUtil.isEmpty(trgetId)) - throw new RuntimeException("사용자ID는 필수조건 입니다."); - vo.setUserId(trgetId); - listUserInfo = xitFrameCrudService.findXitUserInfos(vo); - } - - - for(XitUserInfoVO userInfoVO : listUserInfo) { - String newPassword = XitScrtyUtil.encryptPassword("1", userInfoVO.getUserId()); - vo = new XitUserInfoVO(); - vo.setUserId(userInfoVO.getUserId()); - vo.setPasswd(newPassword); - xitFrameCrudService.modifyXitUserInfo(vo); - } - - } catch (Exception e) { - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
처리 도중 error 발생.
")); - writer.write(String.format("
error details...-> %s
", e.getMessage())); - writer.write("================================================================"); - writer.close(); - return; - } - - resp.setCharacterEncoding("UTF-8"); - resp.setContentType("text/html charset=UTF-8"); - Writer writer = resp.getWriter(); - writer.write("================================================================"); - writer.write(String.format("
처리 결과:::::::%s건의 사용자 비밀번호 초기화 완료
", listUserInfo.size())); - writer.write("================================================================"); - writer.close(); - - - - } - - /** - *
메소드 설명: tui grid 테스트 
- * @param resp - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 5. 17. - */ - @RequestMapping(name = "", value="case6") - public String case6(HttpServletResponse resp, @RequestParam(name="tiles", required=false, defaultValue="") String tiles) throws IOException { - switch (tiles.toUpperCase()) { - case "N": - return TEST_JSP_PATH+"TuiGrid"+TILES_TYPE.NONE.getVal(); - default: - return TEST_JSP_PATH+"TuiGrid"; - } - - } - /** - *
메소드 설명: tui grid 데이터 조회
- * @return - * @throws IOException Map 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2020. 5. 17. - */ - @RequestMapping(name = "", value="case7") - @ResponseBody - public Map case7(@RequestParam Map m) throws IOException { - /** - * 조회 - */ - List list = xitFrameCrudService.findXitUserInfos(new XitUserInfoVO()); - - /**AA - * 응답결과 설정 - */ - Map resultMap = new HashMap(); - resultMap.put("data", list); - resultMap.putAll(m); - return resultMap; - } - - - /** - *
메소드 설명: 대용량 insert 테스트
- * @param m - * @return - * @throws IOException Map 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 17. - */ - @RequestMapping(name = "", value="case8") - @ResponseBody - public Map case8(@RequestParam Map m) throws IOException { - /** - * 처리 - */ - int dataSize = XitCmmnUtil.isEmpty(m.get("dataSize"))?0:Integer.parseInt(m.get("dataSize")); - String type = "unknown"; - int result = 0; - long startTime = System.currentTimeMillis(); - switch (m.get("type")) { - case "single": - case "1": - //single insert SQL 사용 - type = "Single"; - result = xitTestService.insertBatchTestBySingle(dataSize); - break; - case "bulk": - case "2": - //foreach insert SQL 사용 - type = "Bulk"; - result = xitTestService.insertBatchTestByBulk(dataSize); - break; - default: - //single insert SQL 사용 - type = "Single"; - result = xitTestService.insertBatchTestBySingle(dataSize); - break; - } - long endTime = System.currentTimeMillis(); - - /** - * 응답결과 설정 - */ - Map resultMap = new HashMap(); - resultMap.put("message", String.format("%s 타입으로 총 %d건 등록 %d초 소요", type, result, (endTime-startTime)/1000 )); - return resultMap; - } - - @RequestMapping(name = "", value="case9") - public void case9(@RequestParam Map m, HttpServletResponse response) throws IOException { - final String PATH = "C:/xit/test/"; - final String FILE_NAME = "api.log"; - - printLog(PATH, FILE_NAME, "hahaha"); - printLog(PATH, FILE_NAME, "kkkkkk"); - printLog(PATH, FILE_NAME, "hohoho"); - - downloadLog(response, PATH+FILE_NAME); - } - - - /** - *
메소드 설명: 엑셀 저장
- * @param m - * @param response - * @author: 박민규 - * @throws Exception - * @date: 2021. 9. 24. - */ - @RequestMapping(name = "", value="case10") - public String case10(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws Exception { - response.setHeader("Content-disposition", "attachment; filename=" + XitCmmnUtil.getFileNameForDownload(request, "엑셀파일 저장 테스트.xlsx")); - - - StringBuffer columns = new StringBuffer(); //jsonArray 포맷 String으로 작성 - columns.append("[") - .append("{\"title\" : \"컬럼1\", \"name\" : \"col1\"}") - .append(",{\"title\" : \"컬럼2\", \"name\" : \"col2\"}") - .append(",{\"title\" : \"컬럼3\", \"name\" : \"col3\"}") - .append(",{\"title\" : \"컬럼4\", \"name\" : \"col4\"}") - .append("]"); - List> list = new ArrayList>(); //contents - Map row = new HashMap(); - row.put("col1", 123); row.put("col2", "2021-09-21"); row.put("col3", "123,456,789" ); row.put("col4", "abc"); - list.add(row); - row = new HashMap(); - row.put("col1", 456); row.put("col2", "2021-09-22"); row.put("col3", "123,456,789.22"); row.put("col4", "가나다"); - list.add(row); - row = new HashMap(); - row.put("col1", 789); row.put("col2", "2021-09-23"); row.put("col3", 123456789L ); row.put("col4", "0123456789"); - list.add(row); - row = new HashMap(); - row.put("col1", 012); row.put("col2", "2021-09-24"); row.put("col3", 123456789.44 ); row.put("col4", "010-1111-222"); - list.add(row); - - - - logger.debug("EXCEL LIST : " + list); - - model.put("header", columns.toString()); - model.put("contents", list); - - return "excelView"; - } - - /** - *
메소드 설명: 로그 출력
-	 * 	- API 호출 시 로그정보를 파일에 저장 한다.
-	 * 
- * @param PATH 파일경로(ex> 윈도우 C:/logs/ 리눅스계열: /logs/) - * @param FILE_NAME 파일명(ex> api.log) - * @param MESSAGE 메세지 - * @throws IOException void 요청처리 후 응답객체 - * @author: 박민규 - * @date: 2021. 1. 28. - */ - private void printLog(final String PATH, final String FILE_NAME, final String MESSAGE) throws IOException { - //디렉토리가 없으면.. 생성 - File dir = new File(PATH); - if(!dir.isDirectory()) - dir.mkdirs(); - - //로그 출력 - SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - FileOutputStream fos = new FileOutputStream(PATH+FILE_NAME, true); - OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); - BufferedWriter writer = null; - try { - writer = new BufferedWriter(osw); - writer.write(String.format("%s LOG [%s]", date.format(new Date()), MESSAGE )); - writer.write("\r\n"); - } catch (Exception e) { - e.printStackTrace(); - } finally { - //BufferedWriter close.. - if(writer != null) { - writer.close(); - } - //OutputStreamWriter close.. - if(osw != null) { - osw.close(); - } - //FileOutputSteam close.. - if(fos != null) { - fos.close(); - } - } - } - - - private void downloadLog(HttpServletResponse response, String pathname) throws IOException { - File file = new File(pathname); - - if (!file.exists()) { - throw new FileNotFoundException(pathname); - } - if (!file.isFile()) { - throw new FileNotFoundException(pathname); - } - - response.setContentLength((int) file.length()); - response.addHeader("Content-Disposition", "attachment;filename=" + file.getName() + ";"); - - FileInputStream fis = new FileInputStream(file); - OutputStream os = response.getOutputStream(); - byte[] bytes = new byte[256]; - int readBytes = 0; - while ((readBytes = fis.read(bytes, 0, bytes.length)) != -1) { - os.write(bytes, 0, readBytes); - } - os.flush(); - - } - - - - -} diff --git a/src/main/java/kr/xit/fims/framework/biz/util/ExtnlInterfaceUtils.java b/src/main/java/kr/xit/fims/framework/biz/util/ExtnlInterfaceUtils.java index d829eb9a..e1bfbb33 100644 --- a/src/main/java/kr/xit/fims/framework/biz/util/ExtnlInterfaceUtils.java +++ b/src/main/java/kr/xit/fims/framework/biz/util/ExtnlInterfaceUtils.java @@ -1,26 +1,12 @@ package kr.xit.fims.framework.biz.util; -import kr.xit.fims.biz.FimsConst; -import kr.xit.fims.biz.cmm.NtriDTO; -import kr.xit.fims.biz.ec.CctvCrackdownDTO; -import kr.xit.fims.framework.biz.cmm.CmmFileDTO; import kr.xit.fims.framework.support.exception.BizRuntimeException; -import kr.xit.fims.framework.support.util.Checks; import kr.xit.fims.framework.support.util.CommUtils; -import kr.xit.fims.framework.support.util.DateUtils; -import kr.xit.fims.framework.support.util.FileUtils; import kr.xit.fims.framework.support.util.constants.MessageKey; import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; - -import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; @Slf4j public class ExtnlInterfaceUtils { diff --git a/src/main/resources/sql/mapper/framework/cmm/XitTest-mysql-mapper.xml b/src/main/resources/sql/mapper/framework/cmm/XitTest-mysql-mapper.xml deleted file mode 100644 index 679deb23..00000000 --- a/src/main/resources/sql/mapper/framework/cmm/XitTest-mysql-mapper.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - /** addTest */ - /** 등록 테스트 */ - INSERT INTO LETTNLOGINLOG( - LOG_ID - ,CONECT_MTHD - ,ERROR_OCCRRNC_YN - ,ERROR_CODE - ,CREAT_DT - )VALUES( - CONCAT('TEST_',LPAD((SELECT IFNULL(REPLACE(MAX(LOG_ID),'TEST_',''),0)+1 AS "LOG_ID" FROM LETTNLOGINLOG WHERE LOG_ID LIKE 'TEST_%') ,14 ,'0') ) - ,'I' - ,'N' - ,IFNULL(#{error_code}, '00') - ,NOW() - ) - - - -