From 67ab00d00c34050004a063a69a15a8c188999a44 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Thu, 23 Jun 2022 13:04:14 +0900 Subject: [PATCH] feat: mpower --- .../ctgy/v2/service/impl/BoardService.java | 20 ++++++++++++++++- .../com/xit/core/util/mpower/MpowerUtils.java | 22 +++++-------------- 2 files changed, 24 insertions(+), 18 deletions(-) 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 dcb923c..7283be0 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 @@ -47,6 +47,23 @@ public class BoardService implements IBoardService { private final PasswordEncoder passwordEncoder; private final SqlSessionTemplate sqlSessionTemplate; + private static final String selectBoardListSql = "SELECT MCB.ci_code,\n" + + " MU.name,\n" + + " MCB.ci_contentno,\n" + + " MCB.ci_title,\n" + + " MCB.ci_contents,\n" + + " MCB.ci_nalja,\n" + + " MCB.ci_step,\n" + + " MCB.ci_revel,\n" + + " MCB.ci_ref,\n" + + " MCB.ci_hit,\n" + + " MCB.ci_pass,\n" + + " MCB.ci_id\n" + + " FROM min_civ_board680 MCB\n" + + " LEFT OUTER JOIN min_userinfo MU\n" + + " ON MCB.ci_id = MU.userid\n" + + " ORDER BY MCB.ci_ref DESC, MCB.ci_step ASC, MCB.ci_code ASC"; + @Transactional(readOnly = true) public List> findAll(final BoardDto dto, Pageable pageable) { @@ -54,7 +71,8 @@ public class BoardService implements IBoardService { MpowerUtils sendXml = new MpowerUtils(); sendXml.setFeilds("ciCode, ciName, ciContentno, ciTitle, ciContents, ciNalja, ciStep, ciRevel, ciRef, ciHit, ciPass, ciId"); - sendXml.setQuery(sql); + //sendXml.setQuery(sql); + sendXml.setQuery(selectBoardListSql); return sendXml.selectCustomQuery(); } diff --git a/src/main/java/com/xit/core/util/mpower/MpowerUtils.java b/src/main/java/com/xit/core/util/mpower/MpowerUtils.java index c256ca2..9f84165 100644 --- a/src/main/java/com/xit/core/util/mpower/MpowerUtils.java +++ b/src/main/java/com/xit/core/util/mpower/MpowerUtils.java @@ -1,19 +1,8 @@ package com.xit.core.util.mpower; import com.plf.client.Client; -import com.xit.core.util.CommUtil; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.codec.binary.StringUtils; -import org.apache.ibatis.mapping.BoundSql; -import org.apache.ibatis.mapping.ParameterMapping; -import org.apache.ibatis.session.SqlSession; - -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; + import java.sql.*; import java.util.ArrayList; import java.util.HashMap; @@ -361,7 +350,7 @@ public class MpowerUtils { //logger.debug("=====================================================Select Query=================================================="); //logger.debug(query); - System.out.println("======"+query); + log.debug("query\n"+query); //List mList = new ArrayList(); List> mList = new ArrayList<>(); int mListCount = 0; @@ -373,16 +362,15 @@ 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.getMessage()); +// System.out.println("#######message charset = "+CommUtil.detectCharset(mpower.getMessage().getBytes())); +// System.out.println("#######message = "+new String(mpower.getMessage().getBytes(), CommUtil.detectCharset(mpower.getMessage().getBytes()))); int row; if (result.equals("true")){ row = mpower.getMaxRow("list1"); if(row>0){ for(int i=0;i m = new HashMap<>(); if(!"".equals(feild) && feild != null){ m.put("cbContent", mpower.getString("list1", i, 4));