feat: mpower

dev
minuk926 2 years ago
parent 72d5025bd5
commit b835cfee91

@ -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")
})

@ -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")
})

@ -49,95 +49,14 @@ public class BoardService implements IBoardService {
@Transactional(readOnly = true)
public List<Map<String, Object>> 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)

@ -23,7 +23,7 @@ public class EncodingFilterConfig {
FilterRegistrationBean<CharacterEncodingFilter> 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;

@ -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<charSet.length; i++) {
for (int j=0; j<charSet.length; j++) {
try {
System.out.println("[" + charSet[i] +"," + charSet[j] +"] = " + new String(originalStr.getBytes("latin1"), charSet[j]));
}
catch (UnsupportedEncodingException e) {
System.out.println(e.getLocalizedMessage());
}
}
}
//System.out.println(CommUtil.detectCharset(originalStr.getBytes()));
System.out.println("#######message = "+mpower.getMessage());
System.out.println("#######message charset = "+CommUtil.detectCharset(mpower.getMessage().getBytes()));
int row;
if (result.equals("true")){
@ -729,17 +678,13 @@ public class MpowerUtil {
Map<String,Object> 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.size();j++){
//m.put(feilds.get(j), new String(mpower.getString("list1", i, j).getBytes("utf-8"), "utf-8"));
m.put(feilds.get(j), mpower.getString("list1", i, j));
}
}
mList.add(m);
}
//mListMap.put("resultList", mList);
//mList;
}
}
mpower.disconnect();
@ -749,8 +694,6 @@ public class MpowerUtil {
} finally{
clearValidation();
}
String s = String.valueOf(mList);
byte[] b = s.getBytes(StandardCharsets.UTF_8);
return mList;
}
@ -763,91 +706,6 @@ public class MpowerUtil {
tmpFeilds = string;
}
//단속사진 폴더 및 사진복사
/*public static String[] fnVioPhoto(String mmCode,String mmDbgb,String photocode,String sessionId){
String serviceName = "XitFile.XitDownload";
String[] returnImgStr = new String[4];
String fph = MpowerUtil.class.getResource("").getPath();
mpower2 = new Client(hostip,port);
String tmpPhoto =""; //단속사진 단속구분에 따라 경로변경
if(mmDbgb.equals("11")){
tmpPhoto =vioPhoto;
}else{
tmpPhoto = vioPhotoBus;
}
fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/");
String fphs = fph.substring(0,1);
if(fphs.equals("/")){
fph = fph.substring(1);
}
String imgPath = tmpPhoto + EgovStringUtil.Get_M_ImgFD(photocode) + "/" + EgovStringUtil.Get_C_ImgFD(photocode) + "/" + EgovStringUtil.Get_B_ImgFD(photocode); //터널링에 저장된 단속사진 경로
System.out.println("최종이미지경로:::::" + imgPath);
try{
mpower2.getConnection(serviceName);
mpower2.setInput("dnfile1",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
System.out.println("사진이름:" + EgovStringUtil.ZeroCnt(photocode));
mpower2.setInput("dnfile2",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "B.jpg");
mpower2.setInput("dnfile3",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "C.jpg");
mpower2.setInput("dnfile4",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "D.jpg");
mpower2.Request();
String result = mpower2.getString("result", 0, 0);
if (result.equals("true")){
mpower2.getFileName("imageA");
mpower2.getFileName("imageB");
mpower2.getFileName("imageC");
mpower2.getFileName("imageD");
mpower2.savefile("imageA", fph);
mpower2.savefile("imageB", fph);
mpower2.savefile("imageC", fph);
mpower2.savefile("imageD", fph);
String strpath = "/vioPhoto/"+sessionId+"/P" + EgovStringUtil.ZeroCnt(photocode);
System.out.println("strPath ::: " + strpath);
returnImgStr[0] = strpath + "A.jpg";
returnImgStr[1] = strpath + "B.jpg";
returnImgStr[2] = strpath + "C.jpg";
returnImgStr[3] = strpath + "D.jpg";
}
}catch(Exception e){
}
//logger.debug(fph);
return returnImgStr;
}*/
//버스단속사진
/*public static String[] fnVioPhotoBus(String photocode, String sessionId) {
String fph = MpowerUtil.class.getResource("").getPath();
fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/");
String[] imgFmn = {"A","B","C","D"};
String[] imgFile = new String[4];
try{
File d = new File(fph);
if(!d.isDirectory())d.mkdir();
for (int i = 0; i < imgFmn.length; i++) {
String imgPath = EgovStringUtil.Get_M_ImgFD(photocode) + "/" + EgovStringUtil.Get_C_ImgFD(photocode) + "/" + EgovStringUtil.Get_B_ImgFD(photocode);
String url = "http://211.35.57.16/bus_photo/"+imgPath+"/P" + EgovStringUtil.ZeroCnt(photocode) + imgFmn[i] +".jpg";
System.out.println(" 최종 URL ::: " + url);
BufferedImage img = ImageIO.read(new URL(url));
File f = new File(fph + photocode + imgFmn[i]+".jpg");
ImageIO.write(img, "jpg", f);
imgFile[i] = "/vioPhoto/"+sessionId+ "/"+ photocode + imgFmn[i]+".jpg";
System.out.println(imgFile[i]);
}
}catch(Exception e){
}
return imgFile;
}*/
//첨부파일 터널링 서버로 복사
public void fnFileUpload(String tmpFileLocation,String realRcRilenm){
@ -893,22 +751,4 @@ public class MpowerUtil {
//logger.debug("웹서버 저장되는 첨부파일 위치:"+fph);
System.out.println("웹서버 저장되는 첨부파일 위치:"+fph);
}
/*private static String fileToBinary(String tmpImg1) {
// TODO Auto-generated method stub
//logger.debug(tmpImg1);
String encodedImage = null;
try {
BufferedImage image = ImageIO.read(new File(tmpImg1));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
encodedImage = Base64.encode(baos.toByteArray());
// logger.debug(encodedImage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
encodedImage = "";
}
return encodedImage;
}*/
}

@ -28,13 +28,9 @@ public class MpowerUtils {
Client mpower = null;
static Client mpower2 = null;
//static String hostip = "115.21.123.19";
static String hostip = "127.0.0.1";
static int port = 9999;
static String query = "";
String wholeQuery = "";
//protected static Logger logger = Logger.getLogger(MpowerUtil.class.getName());
static ArrayList<String> feilds = new ArrayList<String>();
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 = "<?xml version='1.0' encoding='utf-8'?><QUERYS DBNAME='"+DbName2+"' DEBUG='true'><QUERY TYPE='select' BATCH='false'><SQL><![CDATA[";
static String beforeXmlsp = beforeXml.replace("select", "spcall");
static String beforeXml = "<?xml version='1.0' encoding='euc-kr'?><QUERYS DBNAME='"+DbName2+"' DEBUG='true'><QUERY TYPE='select' BATCH='false'><SQL><![CDATA[";
static String afterXml = "]]></SQL></QUERY></QUERYS>";
static String afterXmlsp = "]]></SQL>";
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 += "<PARAM><![CDATA["+inputType+":"+Val+"]]></PARAM>";
}
//kkj추가
public void AddParam2(String inputType,long Val){
psParamCount ++;
Params += "<PARAM><![CDATA["+inputType+":"+Val+"]]></PARAM>";
}
public void setParamsBody(){
Params = "<PARAMS>" + Params + "</PARAMS>";
afterXmlsp = "]]></SQL>";
forXmlEnd = "</QUERY></QUERYS>";
}
public void setSPQuerysBody(){
QueryXml = beforeXmlsp + tableNm + "(" +psFinalFarams + ")" + afterXmlsp + Params + forXmlEnd;
}
public void AddFinalParam(int count){
for(int i=0;i<count;i++){
psFinalFarams += (i==0)?"?":",?";
}
}
public Map<String,Object> PsQuery() throws Exception{
//EgovMap resultEgov = new EgovMap();
Map<String,Object> resultEgov = new HashMap<>();
try{
AddFinalParam(psParamCount);
setParamsBody();
setSPQuerysBody();
resultEgov = connreturnMpwoer(QueryXml);
}catch(Exception e)
{
e.printStackTrace();
}finally{
clearValidation();
}
return resultEgov;
}
public Map<String,Object> 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<String,Object> 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<Map<String, Object>> selectQuery() {
String fileList = "";
for(int cnt = 0;cnt<feilds.size();cnt++){
@ -462,7 +345,7 @@ public class MpowerUtils {
* @ SELECT
* @return
*/
public Map<String,Object> selectListQuery2() {
public List<Map<String,Object>> selectCustomQuery() {
//EgovMap mListMap = new EgovMap();
Map<String,Object> mListMap = new HashMap<>();
//배열로 넘어온 필드를 String 오브젝트로 변형
@ -474,185 +357,7 @@ public class MpowerUtils {
fileList += "," + feilds.get(cnt);
}
}
String init="";
String init2="";
init = beforeXml + "select RN,"+ fileList +" from(";
init2 = ")TB where RN BETWEEN "+getFirstIndex()+" and "+getLastIndex()+afterXml;
query = init;
query = query+"select ROWNUM RN,"+fileList+" from(";
query = query+"select distinct "+fileList+" ";
query = query+"from "+tableNm+" ";
query = query+WhereStr+" ";
query = query+Orderby;
query = query+")TA";
query = query+init2;
System.out.println(query);
String Cquery = beforeXml + "select count(*) from " + tableNm +" "+ WhereStr +afterXml;
if(RowNum == true){
feilds = new ArrayList<String>();
this.setFeilds("RN, "+tmpFeilds);
}
//List<EgovMap> mList = new ArrayList<EgovMap>();
List<Map<String, Object>> 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<row;i++){
//EgovMap m = new EgovMap();
Map<String,Object> m = new HashMap<>();
for(int j=0;j<feilds.size();j++){
if(RowNum == false){
m.put(feilds.get(j), mpower.getString("list1", i, j+1));
}else if(RowNum == true){
m.put(feilds.get(j), mpower.getString("list1", i, j));
}
}
mList.add(m);
}
mListMap.put("mList", mList);
}
}
mpower.disconnect();
if(row>0){
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<String,Object> selectListQuery_pay() {
//EgovMap mListMap = new EgovMap();
Map<String,Object> mListMap = new HashMap<>();
//배열로 넘어온 필드를 String 오브젝트로 변형
String fileList = "";
for(int cnt = 0;cnt<feilds.size();cnt++){
if(cnt==0){
fileList += feilds.get(cnt);
}else{
fileList += "," + feilds.get(cnt);
}
}
query = "";
query += beforeXml + "select RN,"+fileList+" from("
+ "select ROWNUM RN,A.* From "
+ "(select GET_PAYMENT_CHK(VD_SGGCODE,VD_CODE) CHK,GET_RECALL_CHK(VD_SGGCODE,VD_CODE) R_CHK,"+fileList+" "
+ "from "+tableNm +" "+ WhereStr + Orderby+ " ) A where CHK='Y' and R_CHK='Y' "
+ ")TB where RN BETWEEN "+getFirstIndex()+" and "+getLastIndex()+afterXml;
System.out.println("과태료 납부 : "+query);
String Cquery = beforeXml + "select count(*) from (select GET_PAYMENT_CHK(VD_SGGCODE,VD_CODE) CHK,GET_RECALL_CHK(VD_SGGCODE,VD_CODE) R_CHK from " + tableNm +" "+ WhereStr +") where CHK='Y' and R_CHK='Y' "+afterXml;
//logger.debug("CountQuery:" + Cquery);
//logger.debug("=====================================================Select Query==================================================");
//logger.debug(query);
System.out.println("CountQuery:" + Cquery);
System.out.println("=====================================================Select Query==================================================");
System.out.println(query);
if(RowNum == true){
feilds = new ArrayList<String>();
this.setFeilds("RN, "+tmpFeilds);
}
//List<EgovMap> mList = new ArrayList<EgovMap>();
List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
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<row;i++){
//EgovMap m = new EgovMap();
Map<String,Object> m = new HashMap<>();
for(int j=0;j<feilds.size();j++){
if(RowNum == false){
m.put(feilds.get(j), mpower2.getString("list1", i, j+1));
}else if(RowNum == true){
m.put(feilds.get(j), mpower2.getString("list1", i, j));
}
}
mList.add(m);
}
mListMap.put("mList", mList);
}
}
//logger.debug("START getString list1 : " + mpower.getString("list1", 0, 0));
//mListCount = Integer.parseInt(mpower.getString("list1", 0, 0));
if(row>0){
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<Map<String,Object>> selectCustomQuery(String sql) {
//EgovMap mListMap = new EgovMap();
Map<String,Object> mListMap = new HashMap<>();
//배열로 넘어온 필드를 String 오브젝트로 변형
String fileList = "";
for(int cnt = 0;cnt<feilds.size();cnt++){
if(cnt==0){
fileList += feilds.get(cnt);
}else{
fileList += "," + feilds.get(cnt);
}
}
query = beforeXml+sql+afterXml;
query = beforeXml+query+afterXml;
//logger.debug("=====================================================Select Query==================================================");
//logger.debug(query);
@ -668,58 +373,8 @@ public class MpowerUtils {
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<charSet.length; i++) {
for (int j=0; j<charSet.length; j++) {
try {
System.out.println("[" + charSet[i] +"," + charSet[j] +"] = " + new String(originalStr.getBytes("latin1"), charSet[j]));
}
catch (UnsupportedEncodingException e) {
System.out.println(e.getLocalizedMessage());
}
}
}
//System.out.println(CommUtil.detectCharset(originalStr.getBytes()));
System.out.println("#######message = "+mpower.getMessage());
System.out.println("#######message charset = "+CommUtil.detectCharset(mpower.getMessage().getBytes()));
int row;
@ -731,17 +386,13 @@ public class MpowerUtils {
Map<String,Object> 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.size();j++){
//m.put(feilds.get(j), new String(mpower.getString("list1", i, j).getBytes("utf-8"), "utf-8"));
m.put(feilds.get(j), mpower.getString("list1", i, j));
}
}
mList.add(m);
}
//mListMap.put("resultList", mList);
//mList;
}
}
mpower.disconnect();
@ -751,8 +402,6 @@ public class MpowerUtils {
} finally{
clearValidation();
}
String s = String.valueOf(mList);
byte[] b = s.getBytes(StandardCharsets.UTF_8);
return mList;
}
@ -765,91 +414,6 @@ public class MpowerUtils {
tmpFeilds = string;
}
//단속사진 폴더 및 사진복사
/*public static String[] fnVioPhoto(String mmCode,String mmDbgb,String photocode,String sessionId){
String serviceName = "XitFile.XitDownload";
String[] returnImgStr = new String[4];
String fph = MpowerUtil.class.getResource("").getPath();
mpower2 = new Client(hostip,port);
String tmpPhoto =""; //단속사진 단속구분에 따라 경로변경
if(mmDbgb.equals("11")){
tmpPhoto =vioPhoto;
}else{
tmpPhoto = vioPhotoBus;
}
fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/");
String fphs = fph.substring(0,1);
if(fphs.equals("/")){
fph = fph.substring(1);
}
String imgPath = tmpPhoto + EgovStringUtil.Get_M_ImgFD(photocode) + "/" + EgovStringUtil.Get_C_ImgFD(photocode) + "/" + EgovStringUtil.Get_B_ImgFD(photocode); //터널링에 저장된 단속사진 경로
System.out.println("최종이미지경로:::::" + imgPath);
try{
mpower2.getConnection(serviceName);
mpower2.setInput("dnfile1",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "A.jpg"); //터널링에 실질 존재하는 경로,파일명
System.out.println("사진이름:" + EgovStringUtil.ZeroCnt(photocode));
mpower2.setInput("dnfile2",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "B.jpg");
mpower2.setInput("dnfile3",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "C.jpg");
mpower2.setInput("dnfile4",imgPath+ "/P" + EgovStringUtil.ZeroCnt(photocode) + "D.jpg");
mpower2.Request();
String result = mpower2.getString("result", 0, 0);
if (result.equals("true")){
mpower2.getFileName("imageA");
mpower2.getFileName("imageB");
mpower2.getFileName("imageC");
mpower2.getFileName("imageD");
mpower2.savefile("imageA", fph);
mpower2.savefile("imageB", fph);
mpower2.savefile("imageC", fph);
mpower2.savefile("imageD", fph);
String strpath = "/vioPhoto/"+sessionId+"/P" + EgovStringUtil.ZeroCnt(photocode);
System.out.println("strPath ::: " + strpath);
returnImgStr[0] = strpath + "A.jpg";
returnImgStr[1] = strpath + "B.jpg";
returnImgStr[2] = strpath + "C.jpg";
returnImgStr[3] = strpath + "D.jpg";
}
}catch(Exception e){
}
//logger.debug(fph);
return returnImgStr;
}*/
//버스단속사진
/*public static String[] fnVioPhotoBus(String photocode, String sessionId) {
String fph = MpowerUtil.class.getResource("").getPath();
fph = fph.replace("WEB-INF/classes/xit/cmmn/utill/", "vioPhoto/"+sessionId+"/");
String[] imgFmn = {"A","B","C","D"};
String[] imgFile = new String[4];
try{
File d = new File(fph);
if(!d.isDirectory())d.mkdir();
for (int i = 0; i < imgFmn.length; i++) {
String imgPath = EgovStringUtil.Get_M_ImgFD(photocode) + "/" + EgovStringUtil.Get_C_ImgFD(photocode) + "/" + EgovStringUtil.Get_B_ImgFD(photocode);
String url = "http://211.35.57.16/bus_photo/"+imgPath+"/P" + EgovStringUtil.ZeroCnt(photocode) + imgFmn[i] +".jpg";
System.out.println(" 최종 URL ::: " + url);
BufferedImage img = ImageIO.read(new URL(url));
File f = new File(fph + photocode + imgFmn[i]+".jpg");
ImageIO.write(img, "jpg", f);
imgFile[i] = "/vioPhoto/"+sessionId+ "/"+ photocode + imgFmn[i]+".jpg";
System.out.println(imgFile[i]);
}
}catch(Exception e){
}
return imgFile;
}*/
//첨부파일 터널링 서버로 복사
public void fnFileUpload(String tmpFileLocation,String realRcRilenm){
@ -896,23 +460,6 @@ public class MpowerUtils {
System.out.println("웹서버 저장되는 첨부파일 위치:"+fph);
}
/*private static String fileToBinary(String tmpImg1) {
// TODO Auto-generated method stub
//logger.debug(tmpImg1);
String encodedImage = null;
try {
BufferedImage image = ImageIO.read(new File(tmpImg1));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
encodedImage = Base64.encode(baos.toByteArray());
// logger.debug(encodedImage);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
encodedImage = "";
}
return encodedImage;
}*/
}

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="board">
<select id="selectBoardList" parameterType="com.xit.biz.ctgy.dto.BoardDto" resultType="camelCaseLinkedMap">
/* board-mapper|selectBoardList|julim */
SELECT MCB.ci_code,
MU.name,
MCB.ci_contentno,
MCB.ci_title,
MCB.ci_contents,
MCB.ci_nalja,
MCB.ci_step,
MCB.ci_revel,
MCB.ci_ref,
MCB.ci_hit,
MCB.ci_pass,
MCB.ci_id
FROM min_civ_board680 MCB
LEFT OUTER JOIN min_userinfo MU
ON MCB.ci_id = MU.userid
<where>
<if test="ciTitle != null and ciTitle != ''">
AND INSTR(MCB.ci_title, #{ciTitle}) > 0
</if>
<if test='ciName != null and ciName != ""'>
AND MCB.ci_name like #{ciName}||'%'
</if>
</where>
ORDER BY MCB.ci_ref DESC,
MCB.ci_step ASC,
MCB.ci_code DESC
</select>
</mapper>
Loading…
Cancel
Save