diff --git a/src/main/java/com/xit/biz/ctgy/controller/BoardController.java b/src/main/java/com/xit/biz/ctgy/controller/BoardController.java index 4f89880..bbe5860 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/BoardController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/BoardController.java @@ -39,6 +39,7 @@ public class BoardController { @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "), @Parameter(in = ParameterIn.QUERY, name = "ciName", description = "이름", required = false, example = " "), + @Parameter(in = ParameterIn.QUERY, name = "ciContents", description = "내용", required = false, example = " "), @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"), @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/BoardController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/BoardController.java index 50b38e0..6a198b8 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/BoardController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/BoardController.java @@ -39,6 +39,7 @@ public class BoardController { @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "), @Parameter(in = ParameterIn.QUERY, name = "ciName", description = "이름", required = false, example = " "), + @Parameter(in = ParameterIn.QUERY, name = "ciContents", description = "내용", required = false, example = " "), @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"), @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java index ee20105..dcb923c 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java @@ -49,95 +49,14 @@ public class BoardService implements IBoardService { @Transactional(readOnly = true) public List> findAll(final BoardDto dto, Pageable pageable) { - //MappedStatement ms = sqlSessionFactory.getConfiguration().getMappedStatement("com.xit.biz.ctgy.mapper.IParkingMapper.selectTotParkingJudgeResultGroupByTeamAndChasu"); + String sql = CommUtil.getMybatisSql(sqlSessionTemplate, "board.selectBoardList", dto); - //SqlSession session = sqlSessionTemplate.getConfiguration().get; - //SqlSession session = sqlSessionTemplate.getConfiguration().getMappedStatement("com.xit.biz.ctgy.mapper.IParkingMapper.selectTotParkingJudgeResultGroupByTeamAndChasu"); - - JudgeListDto param = new JudgeListDto(); - param.setMsChasu(99L); - //param.get - - - String sql = CommUtil.getMybatisSql(sqlSessionTemplate, "com.xit.biz.ctgy.mapper.IParkingMapper.selectTotParkingJudgeResultGroupByTeamAndChasu", param); - System.out.println(sql); - System.out.println(Charset.defaultCharset().displayName()); - - - //SqlSession sqlSession = SqlMapClient.getSqlSession(); - - - MpowerUtil sendXml = new MpowerUtil(); - String query = "SELECT ci_code ciCode,\n" + - " name ciName,\n" + - " ci_contentno ciContentno,\n" + - " ci_title ciTitle,\n" + - " ci_contents ciContents,\n" + - " ci_nalja ciNalja,\n" + - " ci_step ciStep,\n" + - " ci_revel ciRevel,\n" + - " ci_ref ciRef,\n" + - " ci_hit ciHit,\n" + - " ci_pass ciPass,\n" + - " ci_id ciId \n" + - " FROM min_civ_board680 LEFT OUTER JOIN min_userinfo ON (ci_id = userid)\n" + - " WHERE ci_code IN\n" + - " (20,\n" + - " 19,\n" + - " 18,\n" + - " 17,\n" + - " 16,\n" + - " 13,\n" + - " 15,\n" + - " 12,\n" + - " 14,\n" + - " 11,\n" + - " 9,\n" + - " 10,\n" + - " 7,\n" + - " 8,\n" + - " 6,\n" + - " 4,\n" + - " 3,\n" + - " 1,\n" + - " 5,\n" + - " 2)"; + MpowerUtils sendXml = new MpowerUtils(); sendXml.setFeilds("ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId"); - sendXml.setQuery(query); - - - -// SqlMapClientImpl sqlMapClientImpl; -// MappedStatement mappedStatement; -// StatementScope statementScope; -// SessionScope sessionScope; -// Sql sql ; -// -// //ibatis에서 sqlMapClient인터페이스 구현체는 sqlMapClientImpl 밖에 없습니다. doc 참조 -// //다운캐스팅 합니다. -// sqlMapClientImpl = (SqlMapClientImpl)this.sqlMapClientTemplate.getSqlMapClient(); -// //sqlmap statement 객체를 구합니다. -// mappedStatement = sqlMapClientImpl.getMappedStatement("selectMember"); -// -// //iBatis에서는 ThreadLocal를 통해서 세션을 정의합니다. -// sessionScope = new SessionScope(); -// statementScope = new StatementScope(sessionScope); -// //이부분 매우 중요합니다. 이부분을 생략 하면 다이나믹 쿼리가 적용되지 않습니다. -// mappedStatement.initRequest(statementScope); -// //sql을 추출 합니다. -// sql = mappedStatement.getSql(); -// -// if(logger.isDebugEnabled()){ -// logger.debug("======================="+ -// sql.getSql(statementScope,parameterMap); -// } - - + sendXml.setQuery(sql); return sendXml.selectCustomQuery(); - //log.debug("{}", map); - //return map.get("resultList"); } // @Transactional(readOnly = true) diff --git a/src/main/java/com/xit/core/config/EncodingFilterConfig.java b/src/main/java/com/xit/core/config/EncodingFilterConfig.java index d561502..657f50a 100644 --- a/src/main/java/com/xit/core/config/EncodingFilterConfig.java +++ b/src/main/java/com/xit/core/config/EncodingFilterConfig.java @@ -23,7 +23,7 @@ public class EncodingFilterConfig { FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); CharacterEncodingFilter filter = new OrderedCharacterEncodingFilter(); filter.setForceEncoding(true); - filter.setEncoding("utf-8"); + filter.setEncoding("euc-kr"); registrationBean.setFilter(filter); registrationBean.addUrlPatterns("/api/v2/*"); return registrationBean; diff --git a/src/main/java/com/xit/core/util/mpower/MpowerUtil.java b/src/main/java/com/xit/core/util/mpower/MpowerUtil.java index a4fbce9..8da5ea5 100644 --- a/src/main/java/com/xit/core/util/mpower/MpowerUtil.java +++ b/src/main/java/com/xit/core/util/mpower/MpowerUtil.java @@ -666,59 +666,8 @@ public class MpowerUtil { mpower.Request(); String result = mpower.getString("result", 0, 0); - - - System.out.println("#######message = "+mpower.getFile("list1")); - - String s = "답변드립니다"; - //System.out.println(CommUtil.detectCharset(s.getBytes())); - - System.out.println(URLEncoder.encode(s, "euc-kr")); - System.out.println(URLDecoder.decode(s, "euc-kr")); - String ss = new String("답변드립니다".getBytes("euc-kr"), "euc-kr"); - System.out.println(CommUtil.detectCharset(ss.getBytes())); - - System.out.println((new String("답변드립니다".getBytes("utf-8"), "euc-kr"))); - System.out.println((new String("답변드립니다".getBytes("euc-kr"), "euc-kr"))); - - -// System.out.println(new String(s.getBytes("unicode"), "unicode")); -// System.out.println(new String(s.getBytes("utf-8"), "utf-8")); -// System.out.println(new String(s.getBytes("utf-16"), "utf-16")); -// System.out.println(new String(s.getBytes("euc-kr"), "euc-kr")); -// System.out.println(new String(s.getBytes("ksc5601"), "ksc5601")); -// System.out.println(new String(s.getBytes("ms949"), "ms949")); -// System.out.println(new String(s.getBytes("iso-8859-1"), "iso-8859-1")); - - //String originalStr = URLDecoder.decode(mpower.getMessage(), "utf-8"); - System.out.println(URLDecoder.decode(mpower.getMessage(), "utf-8")); - System.out.println(URLDecoder.decode(mpower.getMessage(), "euc-kr")); - System.out.println(StringUtils.newStringUtf16Le(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringUtf16(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringUtf16Be(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringIso8859_1(mpower.getMessage().getBytes())); - - String originalStr = mpower.getMessage(); - String [] charSet = {"utf-8","euc-kr","ksc5601","iso-8859-1","x-windows-949", "ms949"}; - - for (int i=0; i m = new HashMap<>(); if(!"".equals(feild) && feild != null){ m.put("cbContent", mpower.getString("list1", i, 4)); - //m.put("cbContent", new String(mpower.getString("list1", i, 4).getBytes("utf-8"), "utf-8")); }else{ for(int j=0;j feilds = new ArrayList(); static String feild = ""; static String tmpFeilds = ""; @@ -43,79 +39,32 @@ public class MpowerUtils { static String WhereStr = ""; static String Orderby = ""; static int pageIndex = 0; - static int firstIndex = 0; static int lastIndex = 10; static int recordCountPerPage = 10; - static String beforeXml = ""; - static String afterXmlsp = "]]>"; - static Boolean pagingYn = false; + //Ps변수 static String Params = ""; - static String finalParams = ""; - static String threeXml = ""; - static String threeXmlEnd = ""; - static String forXmlEnd = ""; + static int psParamCount = 0; static String psFinalFarams =""; static String QueryXml = ""; - //static String vioPhoto = PropertiesUtil.getValue("Globals.vioPhoto"); //주정차사진경로 static String vioPhoto = ""; - //static String vioPhotoBus = PropertiesUtil.getValue("Globals.vioPhotoBus"); //버스사진경로 static String vioPhotoBus = ""; - //static String tunullingFile = PropertiesUtil.getValue("Globals.tunullingFile"); //터널링서버에 복사되는 첨부파일 위치 static String tunullingFile = ""; public void setQuery(String query){ MpowerUtils.query = query; } - public void setRowNum(boolean truefalse){ - RowNum = truefalse; - } - - public void setPageIndex(int pi){ - pageIndex = pi; - } - - public void setRecordCountPerPage(int rcpp){ - recordCountPerPage = rcpp; - } - - public int getRecordCountPerPage(){ - return recordCountPerPage; - } - - public String getWholeQuery() { - return wholeQuery; - } - - public void setWholeQuery(String wholeQuery) { - this.wholeQuery = wholeQuery; - } - public void setFeild(String feildNm){ feilds.add(feildNm); } - public void setFeild2(String feildNm){ - feild = feildNm; - } - - public void setTableNm(String tNm){ - tableNm = tNm; - } - public void setWhereStr(String whr){ - WhereStr += whr; - } - public void setOrderby(String ob){ - Orderby += ob; - } - public int getFirstIndex() { return (pageIndex - 1) * recordCountPerPage +1; } @@ -124,72 +73,6 @@ public class MpowerUtils { return lastIndex = pageIndex * recordCountPerPage; } - public void setPagingYn(Boolean yn){ - pagingYn = yn; - } - - public void AddParam(String inputType,String Val){ - psParamCount ++; - Params += ""; - } - - //kkj추가 - public void AddParam2(String inputType,long Val){ - psParamCount ++; - Params += ""; - } - - public void setParamsBody(){ - Params = "" + Params + ""; - - afterXmlsp = "]]>"; - forXmlEnd = ""; - } - - public void setSPQuerysBody(){ - QueryXml = beforeXmlsp + tableNm + "(" +psFinalFarams + ")" + afterXmlsp + Params + forXmlEnd; - } - - public void AddFinalParam(int count){ - for(int i=0;i PsQuery() throws Exception{ - //EgovMap resultEgov = new EgovMap(); - Map resultEgov = new HashMap<>(); - try{ - AddFinalParam(psParamCount); - setParamsBody(); - setSPQuerysBody(); - resultEgov = connreturnMpwoer(QueryXml); - }catch(Exception e) - { - e.printStackTrace(); - }finally{ - clearValidation(); - } - return resultEgov; - } - - public Map connreturnMpwoer(String psQuery) throws Exception{ - mpower = new Client(hostip,port); - mpower.getConnection("MPowerXmlToQuery.xmlQuery1"); - mpower.setInput("SQLXML", psQuery); - mpower.Request(); - //EgovMap eMap = new EgovMap(); - Map eMap = new HashMap<>(); - eMap.put("result",mpower.getString("result", 0, 0)); - - int cnt = 1; - for( int i = 0 ; i < mpower.getMaxCol("list1"); i++){ - eMap.put("list"+cnt,mpower.getString("list1", 0, i)); - cnt ++; - } - return eMap; - } - public List> selectQuery() { String fileList = ""; for(int cnt = 0;cnt selectListQuery2() { - //EgovMap mListMap = new EgovMap(); - Map mListMap = new HashMap<>(); - //배열로 넘어온 필드를 String 오브젝트로 변형 - String fileList = ""; - for(int cnt = 0;cnt(); - this.setFeilds("RN, "+tmpFeilds); - } - - //List mList = new ArrayList(); - List> mList = new ArrayList<>(); - int mListCount = 0; - try { - mpower = new Client(hostip,port); - mpower.getConnection("MPowerXmlToQuery.xmlQuery1"); - mpower.setInput("SQLXML", query); - mpower.Request(); - String result = mpower.getString("result", 0, 0); - int row = 0; - if (result.equals("true")){ - row = mpower.getMaxRow("list1"); - if(row>0){ - for(int i=0;i m = new HashMap<>(); - for(int j=0;j0){ - mpower = new Client(hostip,port); - mpower.getConnection("MPowerXmlToQuery.xmlQuery1"); - mpower.setInput("SQLXML", Cquery); - mpower.Request(); - - String strList1 = mpower.getString("list1", 0, 0); - - if( !strList1.equals("") && strList1 != null){ - mListCount = Integer.parseInt(strList1); - } - mpower.disconnect(); - } - - } catch (Exception e) { - e.printStackTrace(); - } finally{ - clearValidation(); - } - mListMap.put("mListCount", mListCount); - return mListMap; - } - - public Map selectListQuery_pay() { - //EgovMap mListMap = new EgovMap(); - Map mListMap = new HashMap<>(); - //배열로 넘어온 필드를 String 오브젝트로 변형 - String fileList = ""; - for(int cnt = 0;cnt(); - this.setFeilds("RN, "+tmpFeilds); - } - - //List mList = new ArrayList(); - List> mList = new ArrayList>(); - int mListCount = 0; - try { - mpower2 = new Client(hostip,port); - mpower2.getConnection("MPowerXmlToQuery.xmlQuery1"); - mpower2.setInput("SQLXML", query); - mpower2.Request(); - String result = mpower2.getString("result", 0, 0); - int row = 0; - if (result.equals("true")){ - row = mpower2.getMaxRow("list1"); - if(row>0){ - for(int i=0;i m = new HashMap<>(); - for(int j=0;j0){ - mpower2.getConnection("MPowerXmlToQuery.xmlQuery1"); - mpower2.setInput("SQLXML", Cquery); - mpower2.Request(); - mListCount = Integer.parseInt(mpower2.getString("list1", 0, 0)); - //System.out.println("mListCount:"+mListCount); - } - //logger.debug("END getString list1"); - mpower2.disconnect(); - //logger.debug(Cquery); - //logger.debug("==============================================================================================================="); - - } catch (Exception e) { - e.printStackTrace(); - } finally{ - clearValidation(); - } - mListMap.put("mListCount", mListCount); - return mListMap; - } - - /** - * @ 페이징 처리 SELECT 호출 - * @return - */ - public List> selectCustomQuery(String sql) { + public List> selectCustomQuery() { //EgovMap mListMap = new EgovMap(); Map mListMap = new HashMap<>(); //배열로 넘어온 필드를 String 오브젝트로 변형 @@ -652,7 +357,7 @@ public class MpowerUtils { fileList += "," + feilds.get(cnt); } } - query = beforeXml+sql+afterXml; + query = beforeXml+query+afterXml; //logger.debug("=====================================================Select Query=================================================="); //logger.debug(query); @@ -668,60 +373,10 @@ public class MpowerUtils { mpower.Request(); String result = mpower.getString("result", 0, 0); + System.out.println("#######message = "+mpower.getMessage()); + System.out.println("#######message charset = "+CommUtil.detectCharset(mpower.getMessage().getBytes())); - System.out.println("#######message = "+mpower.getFile("list1")); - - String s = "답변드립니다"; - //System.out.println(CommUtil.detectCharset(s.getBytes())); - - System.out.println(URLEncoder.encode(s, "euc-kr")); - System.out.println(URLDecoder.decode(s, "euc-kr")); - String ss = new String("답변드립니다".getBytes("euc-kr"), "euc-kr"); - System.out.println(CommUtil.detectCharset(ss.getBytes())); - - System.out.println((new String("답변드립니다".getBytes("utf-8"), "euc-kr"))); - System.out.println((new String("답변드립니다".getBytes("euc-kr"), "euc-kr"))); - - -// System.out.println(new String(s.getBytes("unicode"), "unicode")); -// System.out.println(new String(s.getBytes("utf-8"), "utf-8")); -// System.out.println(new String(s.getBytes("utf-16"), "utf-16")); -// System.out.println(new String(s.getBytes("euc-kr"), "euc-kr")); -// System.out.println(new String(s.getBytes("ksc5601"), "ksc5601")); -// System.out.println(new String(s.getBytes("ms949"), "ms949")); -// System.out.println(new String(s.getBytes("iso-8859-1"), "iso-8859-1")); - - //String originalStr = URLDecoder.decode(mpower.getMessage(), "utf-8"); - System.out.println(URLDecoder.decode(mpower.getMessage(), "utf-8")); - System.out.println(URLDecoder.decode(mpower.getMessage(), "euc-kr")); - System.out.println(StringUtils.newStringUtf16Le(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringUtf16(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringUtf16Be(mpower.getMessage().getBytes())); - System.out.println(StringUtils.newStringIso8859_1(mpower.getMessage().getBytes())); - - String originalStr = mpower.getMessage(); - String [] charSet = {"utf-8","euc-kr","ksc5601","iso-8859-1","x-windows-949", "ms949"}; - - for (int i=0; i m = new HashMap<>(); if(!"".equals(feild) && feild != null){ m.put("cbContent", mpower.getString("list1", i, 4)); - //m.put("cbContent", new String(mpower.getString("list1", i, 4).getBytes("utf-8"), "utf-8")); }else{ for(int j=0;j + + + + + + + \ No newline at end of file