최초커밋(일부)
parent
de2430759d
commit
0722887eb2
@ -0,0 +1,111 @@
|
||||
package egovframework.com.cmm;
|
||||
/*
|
||||
* Copyright 2002-2005 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.jdbc.support.lob.LobCreator;
|
||||
import org.springframework.jdbc.support.lob.LobHandler;
|
||||
import egovframework.rte.psl.orm.ibatis.support.AbstractLobTypeHandler;
|
||||
|
||||
/**
|
||||
* iBATIS TypeHandler implementation for Strings that get mapped to CLOBs.
|
||||
* Retrieves the LobHandler to use from SqlMapClientFactoryBean at config time.
|
||||
*
|
||||
* <p>Particularly useful for storing Strings with more than 4000 characters in an
|
||||
* Oracle database (only possible via CLOBs), in combination with OracleLobHandler.
|
||||
*
|
||||
* <p>Can also be defined in generic iBATIS mappings, as DefaultLobCreator will
|
||||
* work with most JDBC-compliant database drivers. In this case, the field type
|
||||
* does not have to be BLOB: For databases like MySQL and MS SQL Server, any
|
||||
* large enough binary type will work.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#setLobHandler
|
||||
* @since 1.1.5
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class AltibaseClobStringTypeHandler extends AbstractLobTypeHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AltibaseClobStringTypeHandler.class);
|
||||
|
||||
/**
|
||||
* Constructor used by iBATIS: fetches config-time LobHandler from
|
||||
* SqlMapClientFactoryBean.
|
||||
*
|
||||
* @see org.springframework.orm.ibatis.SqlMapClientFactoryBean#getConfigTimeLobHandler
|
||||
*/
|
||||
public AltibaseClobStringTypeHandler() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor used for testing: takes an explicit LobHandler.
|
||||
*/
|
||||
protected AltibaseClobStringTypeHandler(LobHandler lobHandler) {
|
||||
super(lobHandler);
|
||||
}
|
||||
|
||||
protected void setParameterInternal(
|
||||
PreparedStatement ps, int index, Object value, String jdbcType, LobCreator lobCreator)
|
||||
throws SQLException {
|
||||
lobCreator.setClobAsString(ps, index, (String) value);
|
||||
}
|
||||
|
||||
|
||||
protected Object getResultInternal(ResultSet rs, int index, LobHandler lobHandler)
|
||||
throws SQLException {
|
||||
|
||||
StringBuffer read_data = new StringBuffer("");
|
||||
int read_length;
|
||||
|
||||
char[] buf = new char[1024];
|
||||
|
||||
Reader rd = lobHandler.getClobAsCharacterStream(rs, index);
|
||||
try {
|
||||
while ((read_length = rd.read(buf)) != -1) {
|
||||
read_data.append(buf, 0, read_length);
|
||||
}
|
||||
} catch (IOException ie) {
|
||||
LOGGER.debug("ie: {}", ie);//SQLException sqle = new SQLException(ie.getMessage());
|
||||
//throw sqle;
|
||||
// 2011.10.10 보안점검 후속조치
|
||||
} finally {
|
||||
if (rd != null) {
|
||||
try {
|
||||
rd.close();
|
||||
} catch (IOException ignore) {
|
||||
LOGGER.debug("IGNORE: {}", ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return read_data.toString();
|
||||
|
||||
//return lobHandler.getClobAsString(rs, index);
|
||||
}
|
||||
|
||||
public Object valueOf(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,189 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.11 이삼섭 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class ComDefaultCodeVO implements Serializable {
|
||||
/**
|
||||
* serialVersion UID
|
||||
*/
|
||||
private static final long serialVersionUID = -2020648489890016404L;
|
||||
|
||||
/** 코드 ID */
|
||||
private String codeId = "";
|
||||
|
||||
/** 상세코드 */
|
||||
private String code = "";
|
||||
|
||||
/** 코드명 */
|
||||
private String codeNm = "";
|
||||
|
||||
/** 코드설명 */
|
||||
private String codeDc = "";
|
||||
|
||||
/** 특정테이블명 */
|
||||
private String tableNm = ""; //특정테이블에서 코드정보를추출시 사용
|
||||
|
||||
/** 상세 조건 여부 */
|
||||
private String haveDetailCondition = "N";
|
||||
|
||||
/** 상세 조건 */
|
||||
private String detailCondition = "";
|
||||
|
||||
/**
|
||||
* codeId attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeId
|
||||
*/
|
||||
public String getCodeId() {
|
||||
return codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeId attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeId
|
||||
* the codeId to set
|
||||
*/
|
||||
public void setCodeId(String codeId) {
|
||||
this.codeId = codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute를 리턴한다.
|
||||
*
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 값을 설정한다.
|
||||
*
|
||||
* @param code
|
||||
* the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeNm
|
||||
*/
|
||||
public String getCodeNm() {
|
||||
return codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeNm
|
||||
* the codeNm to set
|
||||
*/
|
||||
public void setCodeNm(String codeNm) {
|
||||
this.codeNm = codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute를 리턴한다.
|
||||
*
|
||||
* @return the codeDc
|
||||
*/
|
||||
public String getCodeDc() {
|
||||
return codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 값을 설정한다.
|
||||
*
|
||||
* @param codeDc
|
||||
* the codeDc to set
|
||||
*/
|
||||
public void setCodeDc(String codeDc) {
|
||||
this.codeDc = codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* tableNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the tableNm
|
||||
*/
|
||||
public String getTableNm() {
|
||||
return tableNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* tableNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param tableNm
|
||||
* the tableNm to set
|
||||
*/
|
||||
public void setTableNm(String tableNm) {
|
||||
this.tableNm = tableNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* haveDetailCondition attribute를 리턴한다.
|
||||
*
|
||||
* @return the haveDetailCondition
|
||||
*/
|
||||
public String getHaveDetailCondition() {
|
||||
return haveDetailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* haveDetailCondition attribute 값을 설정한다.
|
||||
*
|
||||
* @param haveDetailCondition
|
||||
* the haveDetailCondition to set
|
||||
*/
|
||||
public void setHaveDetailCondition(String haveDetailCondition) {
|
||||
this.haveDetailCondition = haveDetailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* detailCondition attribute를 리턴한다.
|
||||
*
|
||||
* @return the detailCondition
|
||||
*/
|
||||
public String getDetailCondition() {
|
||||
return detailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* detailCondition attribute 값을 설정한다.
|
||||
*
|
||||
* @param detailCondition
|
||||
* the detailCondition to set
|
||||
*/
|
||||
public void setDetailCondition(String detailCondition) {
|
||||
this.detailCondition = detailCondition;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString 메소드를 대치한다.
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : ComDefaultVO.java
|
||||
* @Description : ComDefaultVO class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------- -------- ---------------------------
|
||||
* @ 2009.02.01 조재영 최초 생성
|
||||
*
|
||||
* @author 공통서비스 개발팀 조재영
|
||||
* @since 2009.02.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class ComDefaultVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 검색조건 */
|
||||
private String searchCondition = "";
|
||||
|
||||
/** 검색Keyword */
|
||||
private String searchKeyword = "";
|
||||
|
||||
/** 검색사용여부 */
|
||||
private String searchUseYn = "";
|
||||
|
||||
/** 현재페이지 */
|
||||
private int pageIndex = 1;
|
||||
|
||||
/** 페이지갯수 */
|
||||
private int pageUnit = 10;
|
||||
|
||||
/** 페이지사이즈 */
|
||||
private int pageSize = 10;
|
||||
|
||||
/** firstIndex */
|
||||
private int firstIndex = 1;
|
||||
|
||||
/** lastIndex */
|
||||
private int lastIndex = 1;
|
||||
|
||||
/** recordCountPerPage */
|
||||
private int recordCountPerPage = 10;
|
||||
|
||||
/** 검색KeywordFrom */
|
||||
private String searchKeywordFrom = "";
|
||||
|
||||
/** 검색KeywordTo */
|
||||
private String searchKeywordTo = "";
|
||||
|
||||
public int getFirstIndex() {
|
||||
return firstIndex;
|
||||
}
|
||||
|
||||
public void setFirstIndex(int firstIndex) {
|
||||
this.firstIndex = firstIndex;
|
||||
}
|
||||
|
||||
public int getLastIndex() {
|
||||
return lastIndex;
|
||||
}
|
||||
|
||||
public void setLastIndex(int lastIndex) {
|
||||
this.lastIndex = lastIndex;
|
||||
}
|
||||
|
||||
public int getRecordCountPerPage() {
|
||||
return recordCountPerPage;
|
||||
}
|
||||
|
||||
public void setRecordCountPerPage(int recordCountPerPage) {
|
||||
this.recordCountPerPage = recordCountPerPage;
|
||||
}
|
||||
|
||||
public String getSearchCondition() {
|
||||
return searchCondition;
|
||||
}
|
||||
|
||||
public void setSearchCondition(String searchCondition) {
|
||||
this.searchCondition = searchCondition;
|
||||
}
|
||||
|
||||
public String getSearchKeyword() {
|
||||
return searchKeyword;
|
||||
}
|
||||
|
||||
public void setSearchKeyword(String searchKeyword) {
|
||||
this.searchKeyword = searchKeyword;
|
||||
}
|
||||
|
||||
public String getSearchUseYn() {
|
||||
return searchUseYn;
|
||||
}
|
||||
|
||||
public void setSearchUseYn(String searchUseYn) {
|
||||
this.searchUseYn = searchUseYn;
|
||||
}
|
||||
|
||||
public int getPageIndex() {
|
||||
return pageIndex;
|
||||
}
|
||||
|
||||
public void setPageIndex(int pageIndex) {
|
||||
this.pageIndex = pageIndex;
|
||||
}
|
||||
|
||||
public int getPageUnit() {
|
||||
return pageUnit;
|
||||
}
|
||||
|
||||
public void setPageUnit(int pageUnit) {
|
||||
this.pageUnit = pageUnit;
|
||||
}
|
||||
|
||||
public int getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(int pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* searchKeywordFrom attribute를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSearchKeywordFrom() {
|
||||
return searchKeywordFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordFrom attribute 값을 설정한다.
|
||||
* @param searchKeywordFrom String
|
||||
*/
|
||||
public void setSearchKeywordFrom(String searchKeywordFrom) {
|
||||
this.searchKeywordFrom = searchKeywordFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordTo attribute를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSearchKeywordTo() {
|
||||
return searchKeywordTo;
|
||||
}
|
||||
|
||||
/**
|
||||
* searchKeywordTo attribute 값을 설정한다.
|
||||
* @param searchKeywordTo String
|
||||
*/
|
||||
public void setSearchKeywordTo(String searchKeywordTo) {
|
||||
this.searchKeywordTo = searchKeywordTo;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,408 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.PageContext;
|
||||
import javax.servlet.jsp.tagext.BodyTagSupport;
|
||||
|
||||
import org.apache.taglibs.standard.tag.common.core.Util;
|
||||
|
||||
/**
|
||||
* Cross-Site Scripting 체크하여 값을 되돌려 받는 핸들러 JSP TLD, 자바에서 사용가능
|
||||
*
|
||||
* @author 공통서비스 장동한
|
||||
* @since 2010.11.09
|
||||
* @version 1.0
|
||||
* @see <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2010.11.09 장동한 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovComCrossSiteHndlr extends BodyTagSupport {
|
||||
|
||||
/*
|
||||
* (One almost wishes XML and JSP could support "anonymous tags," given the
|
||||
* amount of trouble we had naming this one!) :-) - sb
|
||||
*/
|
||||
|
||||
// *********************************************************************
|
||||
// Internal state
|
||||
|
||||
private static final long serialVersionUID = -6750233818675360686L;
|
||||
protected Object value; // tag attribute
|
||||
protected String def; // tag attribute
|
||||
protected boolean escapeXml; // tag attribute
|
||||
private boolean needBody; // non-space body needed?
|
||||
|
||||
// *********************************************************************
|
||||
// Construction and initialization
|
||||
|
||||
private String m_sDiffChar ="()[]{}\"',:;= \t\r\n%!+-";
|
||||
//private String m_sDiffChar ="()[]{}\"',:;=%!+-";
|
||||
private String m_sArrDiffChar [] = {
|
||||
"(",")",
|
||||
"[","]",
|
||||
"{","}",
|
||||
""","'",
|
||||
",",":",
|
||||
";","=",
|
||||
" ","\t", //" ","\t",
|
||||
"\r","\n", //"\r","\n",
|
||||
"%","!",
|
||||
"+","-"
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new handler. As with TagSupport, subclasses should not
|
||||
* provide other constructors and are expected to call the superclass
|
||||
* constructor.
|
||||
*/
|
||||
public EgovComCrossSiteHndlr() {
|
||||
super();
|
||||
init();
|
||||
}
|
||||
|
||||
// resets local state
|
||||
private void init() {
|
||||
value = def = null;
|
||||
escapeXml = true;
|
||||
needBody = false;
|
||||
}
|
||||
|
||||
// Releases any resources we may have (or inherit)
|
||||
@Override
|
||||
public void release() {
|
||||
super.release();
|
||||
init();
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// Tag logic
|
||||
|
||||
// evaluates 'value' and determines if the body should be evaluted
|
||||
@Override
|
||||
public int doStartTag() throws JspException {
|
||||
|
||||
needBody = false; // reset state related to 'default'
|
||||
this.bodyContent = null; // clean-up body (just in case container is
|
||||
// pooling tag handlers)
|
||||
|
||||
JspWriter out = pageContext.getOut();
|
||||
//System.out.println("EgovComCrossSiteFilter> ============================");
|
||||
try {
|
||||
// print value if available; otherwise, try 'default'
|
||||
if (value != null) {
|
||||
//System.out.println("EgovComCrossSiteFilter> =value");
|
||||
String sWriteEscapedXml = getWriteEscapedXml();
|
||||
//System.out.println("EgovComCrossSiteFilter sWriteEscapedXml>" + sWriteEscapedXml);
|
||||
out.print(sWriteEscapedXml);
|
||||
return SKIP_BODY;
|
||||
} else {
|
||||
// if we don't have a 'default' attribute, just go to the body
|
||||
if (def == null) {
|
||||
needBody = true;
|
||||
return EVAL_BODY_BUFFERED;
|
||||
}
|
||||
|
||||
//System.out.println("EgovComCrossSiteFilter def> ="+def);
|
||||
|
||||
// if we do have 'default', print it
|
||||
if (def != null) {
|
||||
// good 'default'
|
||||
out(pageContext, escapeXml, def);
|
||||
//System.out.println("EgovComCrossSiteFilter> ="+def);
|
||||
}
|
||||
return SKIP_BODY;
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
throw new JspException(ex.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
// prints the body if necessary; reports errors
|
||||
@Override
|
||||
public int doEndTag() throws JspException {
|
||||
try {
|
||||
//System.out.println("EgovComCrossSiteFilter ==== doEndTag");
|
||||
if (!needBody){
|
||||
return EVAL_PAGE; // nothing more to do
|
||||
}
|
||||
|
||||
// trim and print out the body
|
||||
if (bodyContent != null && bodyContent.getString() != null){
|
||||
//String sWriteEscapedXml = getWriteEscapedXml();
|
||||
//out2(pageContext, escapeXml, sWriteEscapedXml.toString());
|
||||
//System.out.println("EgovComCrossSiteFilter> end");
|
||||
//System.out.println("EgovComCrossSiteFilter sWriteEscapedXml > sWriteEscapedXml");
|
||||
out(pageContext, escapeXml, bodyContent.getString().trim());
|
||||
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
} catch (IOException ex) {
|
||||
throw new JspException(ex.toString(), ex);
|
||||
}
|
||||
}
|
||||
|
||||
// *********************************************************************
|
||||
// Public utility methods
|
||||
|
||||
/**
|
||||
* Outputs <tt>text</tt> to <tt>pageContext</tt>'s current JspWriter. If
|
||||
* <tt>escapeXml</tt> is true, performs the following substring replacements
|
||||
* (to facilitate output to XML/HTML pages):
|
||||
*
|
||||
* & -> & < -> < > -> > " -> " ' -> '
|
||||
*
|
||||
* See also Util.escapeXml().
|
||||
*/
|
||||
public static void out(PageContext pageContext, boolean escapeXml,
|
||||
Object obj) throws IOException {
|
||||
JspWriter w = pageContext.getOut();
|
||||
|
||||
if (!escapeXml) {
|
||||
// write chars as is
|
||||
if (obj instanceof Reader) {
|
||||
Reader reader = (Reader) obj;
|
||||
char[] buf = new char[4096];
|
||||
int count;
|
||||
while ((count = reader.read(buf, 0, 4096)) != -1) {
|
||||
w.write(buf, 0, count);
|
||||
}
|
||||
} else {
|
||||
w.write(obj.toString());
|
||||
}
|
||||
} else {
|
||||
// escape XML chars
|
||||
if (obj instanceof Reader) {
|
||||
Reader reader = (Reader) obj;
|
||||
char[] buf = new char[4096];
|
||||
int count;
|
||||
while ((count = reader.read(buf, 0, 4096)) != -1) {
|
||||
writeEscapedXml(buf, count, w);
|
||||
}
|
||||
} else {
|
||||
String text = obj.toString();
|
||||
writeEscapedXml(text.toCharArray(), text.length(), w);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void out2(PageContext pageContext, boolean escapeXml,
|
||||
Object obj) throws IOException {
|
||||
JspWriter w = pageContext.getOut();
|
||||
|
||||
w.write(obj.toString());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
private static void writeEscapedXml(char[] buffer, int length, JspWriter w)
|
||||
throws IOException {
|
||||
int start = 0;
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
if (start < i) {
|
||||
w.write(buffer, start, i - start);
|
||||
}
|
||||
// add escaped xml
|
||||
w.write(escaped);
|
||||
start = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// add rest of unescaped portion
|
||||
if (start < length) {
|
||||
w.write(buffer, start, length - start);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private String getWriteEscapedXml() throws IOException {
|
||||
String sRtn = "";
|
||||
|
||||
Object obj = this.value;
|
||||
|
||||
int start = 0;
|
||||
String text = obj.toString();
|
||||
|
||||
int length = text.length();
|
||||
char[] buffer = text.toCharArray();
|
||||
boolean booleanDiff = false;
|
||||
//String sDiffChar
|
||||
//String sArrDiffChar
|
||||
char[] cDiffChar = this.m_sDiffChar.toCharArray();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
|
||||
booleanDiff = false;
|
||||
|
||||
for(int k = 0; k < cDiffChar.length; k++){
|
||||
if(c == cDiffChar[k]){
|
||||
sRtn = sRtn + m_sArrDiffChar[k];
|
||||
booleanDiff = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(booleanDiff) continue;
|
||||
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
//if (start < i) {
|
||||
// sRtn = sRtn + text.substring(start, i - start);
|
||||
//}
|
||||
// add escaped xml
|
||||
//sRtn = sRtn + escaped;
|
||||
//System.out.println(buffer[i]+" :: " + escaped);
|
||||
for (int j = 0; j < escaped.length; j++) {
|
||||
//System.out.println(buffer[i]+" :>: " + escaped[j]);
|
||||
sRtn = sRtn + escaped[j];
|
||||
}
|
||||
//sRtn = sRtn+ escaped.toString();
|
||||
//sRtn = sRtn + String.valueOf(buffer[i]);
|
||||
start = i + 1;
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}
|
||||
|
||||
return sRtn;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Optimized to create no extra objects and write directly to the JspWriter
|
||||
* using blocks of escaped and unescaped characters
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private String getWriteEscapedXml(String sWriteString) throws IOException {
|
||||
|
||||
String sRtn = "";
|
||||
|
||||
Object obj = sWriteString;
|
||||
|
||||
int start = 0;
|
||||
String text = obj.toString();
|
||||
|
||||
int length = text.length();
|
||||
char[] buffer = text.toCharArray();
|
||||
boolean booleanDiff = false;
|
||||
//String sDiffChar
|
||||
//String sArrDiffChar
|
||||
char[] cDiffChar = this.m_sDiffChar.toCharArray();
|
||||
|
||||
for(int i = 0; i < length; i++) {
|
||||
char c = buffer[i];
|
||||
|
||||
booleanDiff = false;
|
||||
|
||||
for(int k = 0; k < cDiffChar.length; k++){
|
||||
if(c == cDiffChar[k]){
|
||||
sRtn = sRtn + m_sArrDiffChar[k];
|
||||
booleanDiff = true;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if(booleanDiff) continue;
|
||||
|
||||
if (c <= Util.HIGHEST_SPECIAL) {
|
||||
char[] escaped = Util.specialCharactersRepresentation[c];
|
||||
if (escaped != null) {
|
||||
// add unescaped portion
|
||||
//if (start < i) {
|
||||
// sRtn = sRtn + text.substring(start, i - start);
|
||||
//}
|
||||
// add escaped xml
|
||||
//sRtn = sRtn + escaped;
|
||||
//System.out.println(buffer[i]+" :: " + escaped);
|
||||
for (int j = 0; j < escaped.length; j++) {
|
||||
//System.out.println(buffer[i]+" :>: " + escaped[j]);
|
||||
sRtn = sRtn + escaped[j];
|
||||
}
|
||||
//sRtn = sRtn+ escaped.toString();
|
||||
//sRtn = sRtn + String.valueOf(buffer[i]);
|
||||
start = i + 1;
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}else{
|
||||
sRtn = sRtn + c;
|
||||
}
|
||||
}
|
||||
|
||||
return sRtn;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setDefault(String def) {
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
// for tag attribute
|
||||
public void setEscapeXml(boolean escapeXml) {
|
||||
this.escapeXml = escapeXml;
|
||||
}
|
||||
/*
|
||||
public static void main(String[] args) throws IOException
|
||||
{
|
||||
|
||||
EgovComCrossSiteHndlr egovComCrossSiteHndlr = new EgovComCrossSiteHndlr();
|
||||
|
||||
egovComCrossSiteHndlr.value = "TRNSMIT";
|
||||
|
||||
String sCrossSiteHndlr = egovComCrossSiteHndlr.getWriteEscapedXml();
|
||||
//System.out.println("writeEscapedXml " + egovComCrossSiteHndlr.getWriteEscapedXml());
|
||||
|
||||
System.out.println("sCrossSiteHndlr|"+ sCrossSiteHndlr + "|");
|
||||
|
||||
try{
|
||||
System.out.println("TRY TEST 1");
|
||||
throw new Exception();
|
||||
}catch(Exception e){
|
||||
System.out.println("TRY TEST 2");
|
||||
}finally{
|
||||
System.out.println("TRY TEST 3");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovComExcepHndlr.java
|
||||
* @Description : 공통서비스의 exception 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 13. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 13.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class EgovComExcepHndlr implements ExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComExcepHndlr.class);
|
||||
|
||||
/**
|
||||
* 발생된 Exception을 처리한다.
|
||||
*/
|
||||
public void occur(Exception ex, String packageName) {
|
||||
LOGGER.debug("[HANDLER][PACKAGE]::: {}", packageName);
|
||||
LOGGER.debug("[HANDLER][Exception]:::", ex);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.exception.handler.ExceptionHandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class EgovComOthersExcepHndlr implements ExceptionHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComOthersExcepHndlr.class);
|
||||
|
||||
public void occur(Exception exception, String packageName) {
|
||||
//log.debug(" EgovServiceExceptionHandler run...............");
|
||||
LOGGER.error(packageName, exception);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.trace.handler.TraceHandler;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovComTraceHandler.java
|
||||
* @Description : 공통서비스의 trace 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2011. 09. 30. JJY
|
||||
*
|
||||
* @author JJY
|
||||
* @since 2011. 9. 30.
|
||||
*
|
||||
*/
|
||||
public class EgovComTraceHandler implements TraceHandler {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovComTraceHandler.class);
|
||||
|
||||
/**
|
||||
* 발생된 메시지를 출력한다.
|
||||
*/
|
||||
public void todo(Class<?> clazz, String message) {
|
||||
//System.out.println("log ==> DefaultTraceHandler run...............");
|
||||
LOGGER.debug("[TRACE]CLASS::: {}", clazz.getName());
|
||||
LOGGER.debug("[TRACE]MESSAGE::: {}", message);
|
||||
//이곳에서 후속처리로 필요한 액션을 취할 수 있다.
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* EgovComUtil 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011.09.15
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011.09.15 서준식 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Service("egovUtil")
|
||||
public class EgovComponentChecker extends EgovAbstractServiceImpl implements ApplicationContextAware{
|
||||
|
||||
|
||||
public static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("static-access")
|
||||
public void setApplicationContext(ApplicationContext context)
|
||||
throws BeansException {
|
||||
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spring MVC에서 설정한 빈이 아닌 서비스 빈(컴포넌트)만을 검색할 수 있음
|
||||
*
|
||||
*/
|
||||
public static boolean hasComponent(String componentName){
|
||||
|
||||
try{
|
||||
Object component = context.getBean(componentName);
|
||||
|
||||
if(component == null){
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
|
||||
}catch(NoSuchBeanDefinitionException ex){// 해당 컴포넌트를 찾을 수없을 경우 false반환
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* 메시지 리소스 사용을 위한 MessageSource 인터페이스 및 ReloadableResourceBundleMessageSource 클래스의 구현체
|
||||
* @author 공통서비스 개발팀 이문준
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.11 이문준 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovMessageSource extends ReloadableResourceBundleMessageSource implements MessageSource {
|
||||
|
||||
private ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @param reloadableResourceBundleMessageSource - resource MessageSource
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public void setReloadableResourceBundleMessageSource(ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource) {
|
||||
this.reloadableResourceBundleMessageSource = reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* getReloadableResourceBundleMessageSource()
|
||||
* @return ReloadableResourceBundleMessageSource
|
||||
*/
|
||||
public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() {
|
||||
return reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 정의된 메세지 조회
|
||||
* @param code - 메세지 코드
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage(String code) {
|
||||
return getReloadableResourceBundleMessageSource().getMessage(code, null, Locale.getDefault());
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import egovframework.rte.ptl.mvc.tags.ui.pagination.AbstractPaginationRenderer;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
/**
|
||||
* ImagePaginationRenderer.java 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011. 9. 16.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011. 9. 16. 서준식 이미지 경로에 ContextPath추가
|
||||
* </pre>
|
||||
*/
|
||||
public class ImagePaginationRenderer extends AbstractPaginationRenderer implements ServletContextAware{
|
||||
|
||||
private ServletContext servletContext;
|
||||
|
||||
public ImagePaginationRenderer() {
|
||||
|
||||
}
|
||||
|
||||
public void initVariables(){
|
||||
firstPageLabel = "<li> </li><li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prevend.gif\" alt=\"처음\" border=\"0\"/></a></li>";
|
||||
previousPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_prev.gif\" alt=\"이전\" border=\"0\"/></a></li>";
|
||||
currentPageLabel = "<li><strong>{0}</strong></li>";
|
||||
otherPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \">{2}</a></li>";
|
||||
nextPageLabel = "<li> <a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_next.gif\" alt=\"다음\" border=\"0\"/></a></li>";
|
||||
lastPageLabel = "<li><a href=\"?pageIndex={1}\" onclick=\"{0}({1});return false; \"><img src=\"" + servletContext.getContextPath() + "/images/egovframework/com/cmm/mod/icon/icon_nextend.gif\" alt=\"마지막\" border=\"0\"/></a></li>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
this.servletContext = servletContext;
|
||||
initVariables();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
/**
|
||||
* IncludedInfo annotation을 바탕으로 화면에 표시할 정보를 구성하기 위한 VO 클래스
|
||||
* @author 공통컴포넌트 정진오
|
||||
* @since 2011.08.26
|
||||
* @version 2.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.08.26 정진오 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class IncludedCompInfoVO {
|
||||
|
||||
private String name;
|
||||
private String listUrl;
|
||||
private int order;
|
||||
private int gid;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getListUrl() {
|
||||
return listUrl;
|
||||
}
|
||||
public void setListUrl(String listUrl) {
|
||||
this.listUrl = listUrl;
|
||||
}
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
public int getGid() {
|
||||
return gid;
|
||||
}
|
||||
public void setGid(int gid) {
|
||||
this.gid = gid;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,270 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Class Name : LoginVO.java
|
||||
* @Description : Login VO class
|
||||
* @Modification Information
|
||||
* @
|
||||
* @ 수정일 수정자 수정내용
|
||||
* @ ------- -------- ---------------------------
|
||||
* @ 2009.03.03 박지욱 최초 생성
|
||||
*
|
||||
* @author 공통서비스 개발팀 박지욱
|
||||
* @since 2009.03.03
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class LoginVO implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8274004534207618049L;
|
||||
|
||||
/** 아이디 */
|
||||
private String id;
|
||||
/** 이름 */
|
||||
private String name;
|
||||
/** 주민등록번호 */
|
||||
private String ihidNum;
|
||||
/** 이메일주소 */
|
||||
private String email;
|
||||
/** 비밀번호 */
|
||||
private String password;
|
||||
/** 비밀번호 힌트 */
|
||||
private String passwordHint;
|
||||
/** 비밀번호 정답 */
|
||||
private String passwordCnsr;
|
||||
/** 사용자구분 */
|
||||
private String userSe;
|
||||
/** 조직(부서)ID */
|
||||
private String orgnztId;
|
||||
/** 조직(부서)명 */
|
||||
private String orgnztNm;
|
||||
/** 고유아이디 */
|
||||
private String uniqId;
|
||||
/** 로그인 후 이동할 페이지 */
|
||||
private String url;
|
||||
/** 사용자 IP정보 */
|
||||
private String ip;
|
||||
/** GPKI인증 DN */
|
||||
private String dn;
|
||||
/**
|
||||
* id attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* id attribute 값을 설정한다.
|
||||
* @param id String
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
* name attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* name attribute 값을 설정한다.
|
||||
* @param name String
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* ihidNum attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getIhidNum() {
|
||||
return ihidNum;
|
||||
}
|
||||
/**
|
||||
* ihidNum attribute 값을 설정한다.
|
||||
* @param ihidNum String
|
||||
*/
|
||||
public void setIhidNum(String ihidNum) {
|
||||
this.ihidNum = ihidNum;
|
||||
}
|
||||
/**
|
||||
* email attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
/**
|
||||
* email attribute 값을 설정한다.
|
||||
* @param email String
|
||||
*/
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
/**
|
||||
* p attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
/**
|
||||
* p attribute 값을 설정한다.
|
||||
* @param p String
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
/**
|
||||
* passwordHint attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPasswordHint() {
|
||||
return passwordHint;
|
||||
}
|
||||
/**
|
||||
* passwordHint attribute 값을 설정한다.
|
||||
* @param passwordHint String
|
||||
*/
|
||||
public void setPasswordHint(String passwordHint) {
|
||||
this.passwordHint = passwordHint;
|
||||
}
|
||||
/**
|
||||
* passwordCnsr attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getPasswordCnsr() {
|
||||
return passwordCnsr;
|
||||
}
|
||||
/**
|
||||
* passwordCnsr attribute 값을 설정한다.
|
||||
* @param passwordCnsr String
|
||||
*/
|
||||
public void setPasswordCnsr(String passwordCnsr) {
|
||||
this.passwordCnsr = passwordCnsr;
|
||||
}
|
||||
/**
|
||||
* userSe attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUserSe() {
|
||||
return userSe;
|
||||
}
|
||||
/**
|
||||
* userSe attribute 값을 설정한다.
|
||||
* @param userSe String
|
||||
*/
|
||||
public void setUserSe(String userSe) {
|
||||
this.userSe = userSe;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getOrgnztId() {
|
||||
return orgnztId;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 값을 설정한다.
|
||||
* @param orgnztId String
|
||||
*/
|
||||
public void setOrgnztId(String orgnztId) {
|
||||
this.orgnztId = orgnztId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUniqId() {
|
||||
return uniqId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 값을 설정한다.
|
||||
* @param uniqId String
|
||||
*/
|
||||
public void setUniqId(String uniqId) {
|
||||
this.uniqId = uniqId;
|
||||
}
|
||||
/**
|
||||
* url attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
/**
|
||||
* url attribute 값을 설정한다.
|
||||
* @param url String
|
||||
*/
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
/**
|
||||
* ip attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
/**
|
||||
* ip attribute 값을 설정한다.
|
||||
* @param ip String
|
||||
*/
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
/**
|
||||
* dn attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getDn() {
|
||||
return dn;
|
||||
}
|
||||
/**
|
||||
* dn attribute 값을 설정한다.
|
||||
* @param dn String
|
||||
*/
|
||||
public void setDn(String dn) {
|
||||
this.dn = dn;
|
||||
}
|
||||
/**
|
||||
* @return the orgnztNm
|
||||
*/
|
||||
public String getOrgnztNm() {
|
||||
return orgnztNm;
|
||||
}
|
||||
/**
|
||||
* @param orgnztNm the orgnztNm to set
|
||||
*/
|
||||
public void setOrgnztNm(String orgnztNm) {
|
||||
this.orgnztNm = orgnztNm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("LoginVO{");
|
||||
sb.append("id='").append(id).append('\'');
|
||||
sb.append(", name='").append(name).append('\'');
|
||||
sb.append(", ihidNum='").append(ihidNum).append('\'');
|
||||
sb.append(", email='").append(email).append('\'');
|
||||
sb.append(", password='").append(password).append('\'');
|
||||
sb.append(", passwordHint='").append(passwordHint).append('\'');
|
||||
sb.append(", passwordCnsr='").append(passwordCnsr).append('\'');
|
||||
sb.append(", userSe='").append(userSe).append('\'');
|
||||
sb.append(", orgnztId='").append(orgnztId).append('\'');
|
||||
sb.append(", orgnztNm='").append(orgnztNm).append('\'');
|
||||
sb.append(", uniqId='").append(uniqId).append('\'');
|
||||
sb.append(", url='").append(url).append('\'');
|
||||
sb.append(", ip='").append(ip).append('\'');
|
||||
sb.append(", dn='").append(dn).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,120 @@
|
||||
package egovframework.com.cmm;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 세션 VO 클래스
|
||||
* @author 공통서비스 개발팀 박지욱
|
||||
* @since 2009.03.06
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.06 박지욱 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class SessionVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2848741427493626376L;
|
||||
/** 아이디 */
|
||||
private String sUserId;
|
||||
/** 이름 */
|
||||
private String sUserNm;
|
||||
/** 이메일 */
|
||||
private String sEmail;
|
||||
/** 사용자구분 */
|
||||
private String sUserSe;
|
||||
/** 조직(부서)ID */
|
||||
private String orgnztId;
|
||||
/** 고유아이디 */
|
||||
private String uniqId;
|
||||
/**
|
||||
* sUserId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserId() {
|
||||
return sUserId;
|
||||
}
|
||||
/**
|
||||
* sUserId attribute 값을 설정한다.
|
||||
* @param sUserId String
|
||||
*/
|
||||
public void setSUserId(String userId) {
|
||||
sUserId = userId;
|
||||
}
|
||||
/**
|
||||
* sUserNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserNm() {
|
||||
return sUserNm;
|
||||
}
|
||||
/**
|
||||
* sUserNm attribute 값을 설정한다.
|
||||
* @param sUserNm String
|
||||
*/
|
||||
public void setSUserNm(String userNm) {
|
||||
sUserNm = userNm;
|
||||
}
|
||||
/**
|
||||
* sEmail attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSEmail() {
|
||||
return sEmail;
|
||||
}
|
||||
/**
|
||||
* sEmail attribute 값을 설정한다.
|
||||
* @param sEmail String
|
||||
*/
|
||||
public void setSEmail(String email) {
|
||||
sEmail = email;
|
||||
}
|
||||
/**
|
||||
* sUserSe attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getSUserSe() {
|
||||
return sUserSe;
|
||||
}
|
||||
/**
|
||||
* sUserSe attribute 값을 설정한다.
|
||||
* @param sUserSe String
|
||||
*/
|
||||
public void setSUserSe(String userSe) {
|
||||
sUserSe = userSe;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getOrgnztId() {
|
||||
return orgnztId;
|
||||
}
|
||||
/**
|
||||
* orgnztId attribute 값을 설정한다.
|
||||
* @param orgnztId String
|
||||
*/
|
||||
public void setOrgnztId(String orgnztId) {
|
||||
this.orgnztId = orgnztId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUniqId() {
|
||||
return uniqId;
|
||||
}
|
||||
/**
|
||||
* uniqId attribute 값을 설정한다.
|
||||
* @param uniqId String
|
||||
*/
|
||||
public void setUniqId(String uniqId) {
|
||||
this.uniqId = uniqId;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package egovframework.com.cmm.annotation;
|
||||
|
||||
/**
|
||||
* 컴포넌트의 포함 정보 표현을 위한 annotation 클래스
|
||||
* 기본적으로 Controller 클래스에 annotation을 부여하되,
|
||||
* 하나의 Controller에 여러 개의 목록성 url mapping이 제공되는 경우에는
|
||||
* 메소드에 annotation을 부여한다.
|
||||
* @author 공통컴포넌트 정진오
|
||||
* @since 2011.08.26
|
||||
* @version 2.0.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.08.26 정진오 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface IncludedInfo {
|
||||
String name() default ""; // 컴포넌트의 한글 이름
|
||||
String listUrl() default ""; // 컴포넌트의 목록정보조회를 위한 URL
|
||||
int order() default 0; // 자동 생성되는 메뉴 목록에 표시되는 순서
|
||||
int gid() default 0; // 컴포넌트의 Group ID(대분류 구분)
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package egovframework.com.cmm.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class HTMLTagFilter implements Filter{
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private FilterConfig config;
|
||||
|
||||
public void doFilter(ServletRequest request, ServletResponse response,
|
||||
FilterChain chain) throws IOException, ServletException {
|
||||
|
||||
chain.doFilter(new HTMLTagFilterRequestWrapper((HttpServletRequest)request), response);
|
||||
}
|
||||
|
||||
public void init(FilterConfig config) throws ServletException {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* Copyright 2008-2009 MOPAS(Ministry of Public Administration and Security).
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package egovframework.com.cmm.filter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
|
||||
public class HTMLTagFilterRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
public HTMLTagFilterRequestWrapper(HttpServletRequest request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
public String[] getParameterValues(String parameter) {
|
||||
|
||||
String[] values = super.getParameterValues(parameter);
|
||||
|
||||
if(values==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (values[i] != null) {
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
for (int j = 0; j < values[i].length(); j++) {
|
||||
char c = values[i].charAt(j);
|
||||
switch (c) {
|
||||
case '<':
|
||||
strBuff.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
//case '&':
|
||||
//strBuff.append("&");
|
||||
//break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
break;
|
||||
default:
|
||||
strBuff.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
values[i] = strBuff.toString();
|
||||
} else {
|
||||
values[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
public String getParameter(String parameter) {
|
||||
|
||||
String value = super.getParameter(parameter);
|
||||
|
||||
if(value==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuffer strBuff = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char c = value.charAt(i);
|
||||
switch (c) {
|
||||
case '<':
|
||||
strBuff.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strBuff.append(">");
|
||||
break;
|
||||
case '&':
|
||||
strBuff.append("&");
|
||||
break;
|
||||
case '"':
|
||||
strBuff.append(""");
|
||||
break;
|
||||
case '\'':
|
||||
strBuff.append("'");
|
||||
break;
|
||||
default:
|
||||
strBuff.append(c);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
value = strBuff.toString();
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package egovframework.com.cmm.interceptor;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.ModelAndViewDefiningException;
|
||||
import org.springframework.web.servlet.mvc.WebContentInterceptor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 인증여부 체크 인터셉터
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011.07.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011.07.01 서준식 최초 생성
|
||||
* 2011.09.07 서준식 인증이 필요없는 URL을 패스하는 로직 추가
|
||||
* 2014.06.11 이기하 인증이 필요없는 URL을 패스하는 로직 삭제(xml로 대체)
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class AuthenticInterceptor extends WebContentInterceptor {
|
||||
|
||||
/**
|
||||
* 세션에 계정정보(LoginVO)가 있는지 여부로 인증 여부를 체크한다.
|
||||
* 계정정보(LoginVO)가 없다면, 로그인 페이지로 이동한다.
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
|
||||
LoginVO loginVO = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
boolean isBool = EgovUserDetailsHelper.isAuthenticated();
|
||||
Object loginSession = request.getSession().getAttribute("LoginVO");
|
||||
String reqUrl = request.getRequestURI();
|
||||
String w2xPath = request.getParameter("w2xPath");
|
||||
|
||||
if (loginSession != null) {
|
||||
return true;
|
||||
} else {
|
||||
ModelAndView modelAndView = new ModelAndView("redirect:/login/loginUsr.do");
|
||||
throw new ModelAndViewDefiningException(modelAndView);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,194 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 공통상세코드 모델 클래스
|
||||
* @author 공통서비스 개발팀 이중호
|
||||
* @since 2009.04.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.04.01 이중호 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class CmmnDetailCode implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6508801327314181679L;
|
||||
|
||||
/*
|
||||
* 코드ID
|
||||
*/
|
||||
private String codeId = "";
|
||||
|
||||
/*
|
||||
* 코드ID명
|
||||
*/
|
||||
private String codeIdNm = "";
|
||||
|
||||
/*
|
||||
* 코드
|
||||
*/
|
||||
private String code = "";
|
||||
|
||||
/*
|
||||
* 코드명
|
||||
*/
|
||||
private String codeNm = "";
|
||||
|
||||
/*
|
||||
* 코드설명
|
||||
*/
|
||||
private String codeDc = "";
|
||||
|
||||
/*
|
||||
* 사용여부
|
||||
*/
|
||||
private String useAt = "";
|
||||
|
||||
/*
|
||||
* 최초등록자ID
|
||||
*/
|
||||
private String frstRegisterId = "";
|
||||
|
||||
/*
|
||||
* 최종수정자ID
|
||||
*/
|
||||
private String lastUpdusrId = "";
|
||||
|
||||
/**
|
||||
* codeId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeId() {
|
||||
return codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeId attribute 값을 설정한다.
|
||||
* @param codeId String
|
||||
*/
|
||||
public void setCodeId(String codeId) {
|
||||
this.codeId = codeId;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeIdNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeIdNm() {
|
||||
return codeIdNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeIdNm attribute 값을 설정한다.
|
||||
* @param codeIdNm String
|
||||
*/
|
||||
public void setCodeIdNm(String codeIdNm) {
|
||||
this.codeIdNm = codeIdNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* code attribute 값을 설정한다.
|
||||
* @param code String
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeNm() {
|
||||
return codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeNm attribute 값을 설정한다.
|
||||
* @param codeNm String
|
||||
*/
|
||||
public void setCodeNm(String codeNm) {
|
||||
this.codeNm = codeNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getCodeDc() {
|
||||
return codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* codeDc attribute 값을 설정한다.
|
||||
* @param codeDc String
|
||||
*/
|
||||
public void setCodeDc(String codeDc) {
|
||||
this.codeDc = codeDc;
|
||||
}
|
||||
|
||||
/**
|
||||
* useAt attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getUseAt() {
|
||||
return useAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* useAt attribute 값을 설정한다.
|
||||
* @param useAt String
|
||||
*/
|
||||
public void setUseAt(String useAt) {
|
||||
this.useAt = useAt;
|
||||
}
|
||||
|
||||
/**
|
||||
* frstRegisterId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getFrstRegisterId() {
|
||||
return frstRegisterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* frstRegisterId attribute 값을 설정한다.
|
||||
* @param frstRegisterId String
|
||||
*/
|
||||
public void setFrstRegisterId(String frstRegisterId) {
|
||||
this.frstRegisterId = frstRegisterId;
|
||||
}
|
||||
|
||||
/**
|
||||
* lastUpdusrId attribute 를 리턴한다.
|
||||
* @return String
|
||||
*/
|
||||
public String getLastUpdusrId() {
|
||||
return lastUpdusrId;
|
||||
}
|
||||
|
||||
/**
|
||||
* lastUpdusrId attribute 값을 설정한다.
|
||||
* @param lastUpdusrId String
|
||||
*/
|
||||
public void setLastUpdusrId(String lastUpdusrId) {
|
||||
this.lastUpdusrId = lastUpdusrId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기 위한 서비스 인터페이스
|
||||
* @author 공통서비스 개발팀 이삼섭
|
||||
* @since 2009.04.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.11 이삼섭 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface EgovCmmUseService {
|
||||
|
||||
/**
|
||||
* 공통코드를 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return List(코드)
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
* ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다.
|
||||
*
|
||||
* @param voList
|
||||
* @return Map(코드)
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception;
|
||||
|
||||
/**
|
||||
* 조직정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 조직정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
|
||||
/**
|
||||
* 그룹정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 그룹정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception;
|
||||
}
|
||||
@ -0,0 +1,115 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngService.java
|
||||
* @Description : 파일정보의 관리를 위한 서비스 인터페이스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public interface EgovFileMngService {
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<FileVO> selectFileInfs(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvoList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInfs(List<?> fvoList) throws Exception;
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public Map<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception;
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception;
|
||||
}
|
||||
@ -0,0 +1,244 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
//import java.io.FileNotFoundException;
|
||||
//import java.io.IOException;
|
||||
//import java.util.Properties;
|
||||
/**
|
||||
* Class Name : EgovProperties.java
|
||||
* Description : properties값들을 파일로부터 읽어와 Globals클래스의 정적변수로 로드시켜주는 클래스로
|
||||
* 문자열 정보 기준으로 사용할 전역변수를 시스템 재시작으로 반영할 수 있도록 한다.
|
||||
* Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.19 박지욱 최초 생성
|
||||
* 2011.07.20 서준식 Globals파일의 상대경로를 읽은 메서드 추가
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 박지욱
|
||||
* @since 2009. 01. 19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
public class EgovProperties{
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovProperties.class);
|
||||
|
||||
//프로퍼티값 로드시 에러발생하면 반환되는 에러문자열
|
||||
public static final String ERR_CODE =" EXCEPTION OCCURRED";
|
||||
public static final String ERR_CODE_FNFE =" EXCEPTION(FNFE) OCCURRED";
|
||||
public static final String ERR_CODE_IOE =" EXCEPTION(IOE) OCCURRED";
|
||||
|
||||
//파일구분자
|
||||
static final char FILE_SEPARATOR = File.separatorChar;
|
||||
|
||||
//프로퍼티 파일의 물리적 위치
|
||||
/*public static final String GLOBALS_PROPERTIES_FILE
|
||||
= System.getProperty("user.home") + System.getProperty("file.separator") + "egovProps"
|
||||
+ System.getProperty("file.separator") + "globals.properties";*/
|
||||
|
||||
public static final String RELATIVE_PATH_PREFIX = EgovProperties.class.getResource("").getPath()
|
||||
+ System.getProperty("file.separator") + ".." + System.getProperty("file.separator")
|
||||
+ ".." + System.getProperty("file.separator") + ".." + System.getProperty("file.separator");
|
||||
|
||||
public static final String GLOBALS_PROPERTIES_FILE
|
||||
= RELATIVE_PATH_PREFIX + "egovProps" + System.getProperty("file.separator") + "globals.properties";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 인자로 주어진 문자열을 Key값으로 하는 상대경로 프로퍼티 값을 절대경로로 반환한다(Globals.java 전용)
|
||||
* @param keyName String
|
||||
* @return String
|
||||
|
||||
public static String getPathProperty(String keyName){
|
||||
String value = ERR_CODE;
|
||||
value="99";
|
||||
debug(GLOBALS_PROPERTIES_FILE + " : " + keyName);
|
||||
FileInputStream fis = null;
|
||||
try{
|
||||
Properties props = new Properties();
|
||||
fis = new FileInputStream(GLOBALS_PROPERTIES_FILE);
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
value = props.getProperty(keyName).trim();
|
||||
value = RELATIVE_PATH_PREFIX + "egovProps" + System.getProperty("file.separator") + value;
|
||||
}catch(FileNotFoundException fne){
|
||||
debug(fne);
|
||||
}catch(IOException ioe){
|
||||
debug(ioe);
|
||||
}catch(Exception e){
|
||||
debug(e);
|
||||
}finally{
|
||||
try {
|
||||
if (fis != null) fis.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다(Globals.java 전용)
|
||||
* @param keyName String
|
||||
* @return String
|
||||
|
||||
public static String getProperty(String keyName){
|
||||
String value = ERR_CODE;
|
||||
value="99";
|
||||
debug(GLOBALS_PROPERTIES_FILE + " : " + keyName);
|
||||
FileInputStream fis = null;
|
||||
try{
|
||||
Properties props = new Properties();
|
||||
fis = new FileInputStream(GLOBALS_PROPERTIES_FILE);
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
value = props.getProperty(keyName).trim();
|
||||
}catch(FileNotFoundException fne){
|
||||
debug(fne);
|
||||
}catch(IOException ioe){
|
||||
debug(ioe);
|
||||
}catch(Exception e){
|
||||
debug(e);
|
||||
}finally{
|
||||
try {
|
||||
if (fis != null) fis.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return value;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 상대 경로값을 절대 경로값으로 반환한다
|
||||
* @param fileName String
|
||||
* @param key String
|
||||
* @return String
|
||||
|
||||
public static String getPathProperty(String fileName, String key){
|
||||
FileInputStream fis = null;
|
||||
try{
|
||||
java.util.Properties props = new java.util.Properties();
|
||||
fis = new FileInputStream(fileName);
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
String value = props.getProperty(key);
|
||||
value = RELATIVE_PATH_PREFIX + "egovProps" + System.getProperty("file.separator") + value;
|
||||
return value;
|
||||
}catch(java.io.FileNotFoundException fne){
|
||||
return ERR_CODE_FNFE;
|
||||
}catch(java.io.IOException ioe){
|
||||
return ERR_CODE_IOE;
|
||||
}finally{
|
||||
try {
|
||||
if (fis != null) fis.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 주어진 파일에서 인자로 주어진 문자열을 Key값으로 하는 프로퍼티 값을 반환한다
|
||||
* @param fileName String
|
||||
* @param key String
|
||||
* @return String
|
||||
|
||||
public static String getProperty(String fileName, String key){
|
||||
FileInputStream fis = null;
|
||||
try{
|
||||
java.util.Properties props = new java.util.Properties();
|
||||
fis = new FileInputStream(fileName);
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
String value = props.getProperty(key);
|
||||
return value;
|
||||
}catch(java.io.FileNotFoundException fne){
|
||||
return ERR_CODE_FNFE;
|
||||
}catch(java.io.IOException ioe){
|
||||
return ERR_CODE_IOE;
|
||||
}finally{
|
||||
try {
|
||||
if (fis != null) fis.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 주어진 프로파일의 내용을 파싱하여 (key-value) 형태의 구조체 배열을 반환한다.
|
||||
* @param property String
|
||||
* @return ArrayList
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public static ArrayList<Map<String, String>> loadPropertyFile(String property){
|
||||
|
||||
// key - value 형태로 된 배열 결과
|
||||
ArrayList<Map<String, String>> keyList = new ArrayList<Map<String, String>>();
|
||||
|
||||
String src = property.replace('\\', FILE_SEPARATOR).replace('/', FILE_SEPARATOR);
|
||||
FileInputStream fis = null;
|
||||
try
|
||||
{
|
||||
|
||||
File srcFile = new File(src);
|
||||
if (srcFile.exists()) {
|
||||
|
||||
java.util.Properties props = new java.util.Properties();
|
||||
fis = new FileInputStream(src);
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
fis.close();
|
||||
|
||||
int i = 0;
|
||||
Enumeration<?> plist = props.propertyNames();
|
||||
if (plist != null) {
|
||||
while (plist.hasMoreElements()) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
String key = (String)plist.nextElement();
|
||||
map.put(key, props.getProperty(key));
|
||||
keyList.add(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception ex){
|
||||
debug("EX:"+ex);
|
||||
} finally {
|
||||
try {
|
||||
if (fis != null) fis.close();
|
||||
} catch (Exception ex) {
|
||||
debug("EX:"+ex);
|
||||
}
|
||||
}
|
||||
|
||||
return keyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 시스템 로그를 출력한다.
|
||||
* @param obj Object
|
||||
*/
|
||||
private static void debug(Object obj) {
|
||||
if (obj instanceof java.lang.Exception) {
|
||||
LOGGER.debug("IGNORED: {}", ((Exception)obj).getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EgovUserDetailsService {
|
||||
|
||||
/**
|
||||
* 인증된 사용자객체를 VO형식으로 가져온다.
|
||||
* @return Object - 사용자 ValueObject
|
||||
*/
|
||||
public Object getAuthenticatedUser();
|
||||
|
||||
/**
|
||||
* 인증된 사용자의 권한 정보를 가져온다.
|
||||
* 예) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY]
|
||||
* @return List - 사용자 권한정보 목록
|
||||
*/
|
||||
public List<String> getAuthorities();
|
||||
|
||||
/**
|
||||
* 인증된 사용자 여부를 체크한다.
|
||||
* @return Boolean - 인증된 사용자 여부(TRUE / FALSE)
|
||||
*/
|
||||
public Boolean isAuthenticated();
|
||||
|
||||
}
|
||||
@ -0,0 +1,243 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* @Class Name : FileVO.java
|
||||
* @Description : 파일정보 처리를 위한 VO 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
public class FileVO implements Serializable {
|
||||
|
||||
/**
|
||||
* serialVersion UID
|
||||
*/
|
||||
private static final long serialVersionUID = -287950405903719128L;
|
||||
/**
|
||||
* 첨부파일 아이디
|
||||
*/
|
||||
public String atchFileId = "";
|
||||
/**
|
||||
* 생성일자
|
||||
*/
|
||||
public String creatDt = "";
|
||||
/**
|
||||
* 파일내용
|
||||
*/
|
||||
public String fileCn = "";
|
||||
/**
|
||||
* 파일확장자
|
||||
*/
|
||||
public String fileExtsn = "";
|
||||
/**
|
||||
* 파일크기
|
||||
*/
|
||||
public String fileMg = "";
|
||||
/**
|
||||
* 파일연번
|
||||
*/
|
||||
public String fileSn = "";
|
||||
/**
|
||||
* 파일저장경로
|
||||
*/
|
||||
public String fileStreCours = "";
|
||||
/**
|
||||
* 원파일명
|
||||
*/
|
||||
public String orignlFileNm = "";
|
||||
/**
|
||||
* 저장파일명
|
||||
*/
|
||||
public String streFileNm = "";
|
||||
|
||||
/**
|
||||
* atchFileId attribute를 리턴한다.
|
||||
*
|
||||
* @return the atchFileId
|
||||
*/
|
||||
public String getAtchFileId() {
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* atchFileId attribute 값을 설정한다.
|
||||
*
|
||||
* @param atchFileId
|
||||
* the atchFileId to set
|
||||
*/
|
||||
public void setAtchFileId(String atchFileId) {
|
||||
this.atchFileId = atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute를 리턴한다.
|
||||
*
|
||||
* @return the creatDt
|
||||
*/
|
||||
public String getCreatDt() {
|
||||
return creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* creatDt attribute 값을 설정한다.
|
||||
*
|
||||
* @param creatDt
|
||||
* the creatDt to set
|
||||
*/
|
||||
public void setCreatDt(String creatDt) {
|
||||
this.creatDt = creatDt;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileCn
|
||||
*/
|
||||
public String getFileCn() {
|
||||
return fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileCn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileCn
|
||||
* the fileCn to set
|
||||
*/
|
||||
public void setFileCn(String fileCn) {
|
||||
this.fileCn = fileCn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileExtsn
|
||||
*/
|
||||
public String getFileExtsn() {
|
||||
return fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileExtsn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileExtsn
|
||||
* the fileExtsn to set
|
||||
*/
|
||||
public void setFileExtsn(String fileExtsn) {
|
||||
this.fileExtsn = fileExtsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileMg
|
||||
*/
|
||||
public String getFileMg() {
|
||||
return fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileMg attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileMg
|
||||
* the fileMg to set
|
||||
*/
|
||||
public void setFileMg(String fileMg) {
|
||||
this.fileMg = fileMg;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileSn
|
||||
*/
|
||||
public String getFileSn() {
|
||||
return fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileSn attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileSn
|
||||
* the fileSn to set
|
||||
*/
|
||||
public void setFileSn(String fileSn) {
|
||||
this.fileSn = fileSn;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute를 리턴한다.
|
||||
*
|
||||
* @return the fileStreCours
|
||||
*/
|
||||
public String getFileStreCours() {
|
||||
return fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* fileStreCours attribute 값을 설정한다.
|
||||
*
|
||||
* @param fileStreCours
|
||||
* the fileStreCours to set
|
||||
*/
|
||||
public void setFileStreCours(String fileStreCours) {
|
||||
this.fileStreCours = fileStreCours;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the orignlFileNm
|
||||
*/
|
||||
public String getOrignlFileNm() {
|
||||
return orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* orignlFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param orignlFileNm
|
||||
* the orignlFileNm to set
|
||||
*/
|
||||
public void setOrignlFileNm(String orignlFileNm) {
|
||||
this.orignlFileNm = orignlFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute를 리턴한다.
|
||||
*
|
||||
* @return the streFileNm
|
||||
*/
|
||||
public String getStreFileNm() {
|
||||
return streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* streFileNm attribute 값을 설정한다.
|
||||
*
|
||||
* @param streFileNm
|
||||
* the streFileNm to set
|
||||
*/
|
||||
public void setStreFileNm(String streFileNm) {
|
||||
this.streFileNm = streFileNm;
|
||||
}
|
||||
|
||||
/**
|
||||
* toString 메소드를 대치한다.
|
||||
*/
|
||||
public String toString() {
|
||||
return ToStringBuilder.reflectionToString(this);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package egovframework.com.cmm.service;
|
||||
|
||||
/**
|
||||
* Class Name : Globals.java
|
||||
* Description : 시스템 구동 시 프로퍼티를 통해 사용될 전역변수를 정의한다.
|
||||
* Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.19 박지욱 최초 생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 박지욱
|
||||
* @since 2009. 01. 19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
public class Globals {
|
||||
//파일 업로드 원 파일명
|
||||
public static final String ORIGIN_FILE_NM = "originalFileName";
|
||||
//파일 확장자
|
||||
public static final String FILE_EXT = "fileExtension";
|
||||
//파일크기
|
||||
public static final String FILE_SIZE = "fileSize";
|
||||
//업로드된 파일명
|
||||
public static final String UPLOAD_FILE_NM = "uploadFileName";
|
||||
//파일경로
|
||||
public static final String FILE_PATH = "filePath";
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
import egovframework.com.cmm.service.CmmnDetailCode;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Class Name : CmmUseDAO.java
|
||||
* @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 데이터 접근 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 11. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 11.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Repository("cmmUseDAO")
|
||||
public class CmmUseDAO extends EgovComAbstractDAO {
|
||||
|
||||
/**
|
||||
* 주어진 조건에 따른 공통코드를 불러온다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectCmmCodeDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드로 사용할 조직정보를 를 불러온다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectOgrnztIdDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통코드로 사용할그룹정보를 를 불러온다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return (List<CmmnDetailCode>) list("CmmUseDAO.selectGroupIdDetail", vo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.ComDefaultCodeVO;
|
||||
import egovframework.com.cmm.service.CmmnDetailCode;
|
||||
import egovframework.com.cmm.service.EgovCmmUseService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovCmmUseServiceImpl.java
|
||||
* @Description : 공통코드등 전체 업무에서 공용해서 사용해야 하는 서비스를 정의하기위한 서비스 구현 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 11. 이삼섭
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 11.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Service("EgovCmmUseService")
|
||||
public class EgovCmmUseServiceImpl extends EgovAbstractServiceImpl implements EgovCmmUseService {
|
||||
|
||||
@Resource(name = "cmmUseDAO")
|
||||
private CmmUseDAO cmmUseDAO;
|
||||
|
||||
/**
|
||||
* 공통코드를 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CmmnDetailCode> selectCmmCodeDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectCmmCodeDetail(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* ComDefaultCodeVO의 리스트를 받아서 여러개의 코드 리스트를 맵에 담아서 리턴한다.
|
||||
*
|
||||
* @param voList
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Map<String, List<CmmnDetailCode>> selectCmmCodeDetails(List<?> voList) throws Exception {
|
||||
ComDefaultCodeVO vo;
|
||||
Map<String, List<CmmnDetailCode>> map = new HashMap<String, List<CmmnDetailCode>>();
|
||||
|
||||
Iterator<?> iter = voList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (ComDefaultCodeVO) iter.next();
|
||||
map.put(vo.getCodeId(), cmmUseDAO.selectCmmCodeDetail(vo));
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 조직정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 조직정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CmmnDetailCode> selectOgrnztIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectOgrnztIdDetail(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 그룹정보를 코드형태로 리턴한다.
|
||||
*
|
||||
* @param 조회조건정보 vo
|
||||
* @return 그룹정보 List
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public List<CmmnDetailCode> selectGroupIdDetail(ComDefaultCodeVO vo) throws Exception {
|
||||
return cmmUseDAO.selectGroupIdDetail(vo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractDAO;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.ibatis.sqlmap.client.SqlMapClient;
|
||||
|
||||
/**
|
||||
* EgovComAbstractDAO.java 클래스
|
||||
*
|
||||
* @author 서준식
|
||||
* @since 2011. 9. 23.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2011. 9. 23. 서준식 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
public abstract class EgovComAbstractDAO extends EgovAbstractDAO{
|
||||
|
||||
|
||||
@Resource(name="egov.sqlMapClient")
|
||||
public void setSuperSqlMapClient(SqlMapClient sqlMapClient) {
|
||||
super.setSuperSqlMapClient(sqlMapClient);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngServiceImpl.java
|
||||
* @Description : 파일정보의 관리를 위한 구현 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Service("EgovFileMngService")
|
||||
public class EgovFileMngServiceImpl extends EgovAbstractServiceImpl implements EgovFileMngService {
|
||||
|
||||
@Resource(name = "FileManageDAO")
|
||||
private FileManageDAO fileMngDAO;
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInfs(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void deleteFileInfs(List<?> fvoList) throws Exception {
|
||||
fileMngDAO.deleteFileInfs(fvoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#insertFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public String insertFileInf(FileVO fvo) throws Exception {
|
||||
String atchFileId = fvo.getAtchFileId();
|
||||
|
||||
fileMngDAO.insertFileInf(fvo);
|
||||
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#insertFileInfs(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public String insertFileInfs(List<?> fvoList) throws Exception {
|
||||
String atchFileId = "";
|
||||
|
||||
if (fvoList.size() != 0) {
|
||||
atchFileId = fileMngDAO.insertFileInfs(fvoList);
|
||||
}
|
||||
if(atchFileId == ""){
|
||||
atchFileId = null;
|
||||
}
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInfs(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public List<FileVO> selectFileInfs(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.selectFileInfs(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#updateFileInfs(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void updateFileInfs(List<?> fvoList) throws Exception {
|
||||
//Delete & Insert
|
||||
fileMngDAO.updateFileInfs(fvoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public void deleteFileInf(FileVO fvo) throws Exception {
|
||||
fileMngDAO.deleteFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.selectFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#getMaxFileSN(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception {
|
||||
return fileMngDAO.getMaxFileSN(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#deleteAllFileInf(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception {
|
||||
fileMngDAO.deleteAllFileInf(fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectFileListByFileNm(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectFileListByFileNm(FileVO fvo) throws Exception {
|
||||
List<FileVO> result = fileMngDAO.selectFileListByFileNm(fvo);
|
||||
int cnt = fileMngDAO.selectFileListCntByFileNm(fvo);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("resultList", result);
|
||||
map.put("resultCnt", Integer.toString(cnt));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @see egovframework.com.cmm.service.EgovFileMngService#selectImageFileList(egovframework.com.cmm.service.FileVO)
|
||||
*/
|
||||
@Override
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
|
||||
return fileMngDAO.selectImageFileList(vo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
import egovframework.com.cmm.service.EgovUserDetailsService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011. 8. 12.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* 개정이력(Modification Information)
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011. 8. 12. 서준식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovTestUserDetailsServiceImpl extends EgovAbstractServiceImpl implements
|
||||
EgovUserDetailsService {
|
||||
|
||||
@Override
|
||||
public Object getAuthenticatedUser() {
|
||||
|
||||
LoginVO loginVO = new LoginVO();
|
||||
loginVO.setId("TEST1");
|
||||
loginVO.setPassword("raHLBnHFcunwNzcDcfad4PhD11hHgXSUr7fc1Jk9uoQ=");
|
||||
loginVO.setUserSe("USR");
|
||||
loginVO.setEmail("egovframe@nia.or.kr");
|
||||
loginVO.setIhidNum("");
|
||||
loginVO.setName("더미사용자");
|
||||
loginVO.setOrgnztId("ORGNZT_0000000000000");
|
||||
loginVO.setUniqId("USRCNFRM_00000000000");
|
||||
return loginVO;
|
||||
|
||||
// return
|
||||
// RequestContextHolder.getRequestAttributes().getAttribute("loginVO",
|
||||
// RequestAttributes.SCOPE_SESSION);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAuthorities() {
|
||||
|
||||
// 권한 설정을 리턴한다.
|
||||
|
||||
List<String> listAuth = new ArrayList<String>();
|
||||
listAuth.add("IS_AUTHENTICATED_ANONYMOUSLY");
|
||||
listAuth.add("IS_AUTHENTICATED_FULLY");
|
||||
listAuth.add("IS_AUTHENTICATED_REMEMBERED");
|
||||
listAuth.add("ROLE_ADMIN");
|
||||
listAuth.add("ROLE_ANONYMOUS");
|
||||
listAuth.add("ROLE_RESTRICTED");
|
||||
listAuth.add("ROLE_USER");
|
||||
|
||||
return listAuth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isAuthenticated() {
|
||||
// 인증된 유저인지 확인한다.
|
||||
|
||||
/*if (RequestContextHolder.getRequestAttributes() == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes().getAttribute(
|
||||
"loginVO", RequestAttributes.SCOPE_SESSION) == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.service.EgovUserDetailsService;
|
||||
|
||||
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 공통서비스 개발팀 서준식
|
||||
* @since 2011. 6. 25.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* 개정이력(Modification Information)
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2011. 8. 12. 서준식 최초생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovUserDetailsSessionServiceImpl extends EgovAbstractServiceImpl implements
|
||||
EgovUserDetailsService {
|
||||
|
||||
public Object getAuthenticatedUser() {
|
||||
|
||||
|
||||
|
||||
return RequestContextHolder.getRequestAttributes().getAttribute("loginVO", RequestAttributes.SCOPE_SESSION);
|
||||
|
||||
}
|
||||
|
||||
public List<String> getAuthorities() {
|
||||
|
||||
// 권한 설정을 리턴한다.
|
||||
List<String> listAuth = new ArrayList<String>();
|
||||
|
||||
return listAuth;
|
||||
}
|
||||
|
||||
public Boolean isAuthenticated() {
|
||||
// 인증된 유저인지 확인한다.
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes() == null) {
|
||||
return false;
|
||||
} else {
|
||||
|
||||
if (RequestContextHolder.getRequestAttributes().getAttribute(
|
||||
"loginVO", RequestAttributes.SCOPE_SESSION) == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,182 @@
|
||||
package egovframework.com.cmm.service.impl;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovFileMngDAO.java
|
||||
* @Description : 파일정보 관리를 위한 데이터 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 3. 25. 이삼섭 최초생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 3. 25.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Repository("FileManageDAO")
|
||||
public class FileManageDAO extends EgovComAbstractDAO {
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public String insertFileInfs(List<?> fileList) throws Exception {
|
||||
FileVO vo = (FileVO) fileList.get(0);
|
||||
String atchFileId = vo.getAtchFileId();
|
||||
|
||||
insert("FileManageDAO.insertFileMaster", vo);
|
||||
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
|
||||
return atchFileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일에 대한 정보(속성 및 상세)를 등록한다.
|
||||
*
|
||||
* @param vo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void insertFileInf(FileVO vo) throws Exception {
|
||||
insert("FileManageDAO.insertFileMaster", vo);
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일에 대한 정보(속성 및 상세)를 수정한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void updateFileInfs(List<?> fileList) throws Exception {
|
||||
FileVO vo;
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
|
||||
insert("FileManageDAO.insertFileDetail", vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 여러 개의 파일을 삭제한다.
|
||||
*
|
||||
* @param fileList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInfs(List<?> fileList) throws Exception {
|
||||
Iterator<?> iter = fileList.iterator();
|
||||
FileVO vo;
|
||||
while (iter.hasNext()) {
|
||||
vo = (FileVO) iter.next();
|
||||
|
||||
delete("FileManageDAO.deleteFileDetail", vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 하나의 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteFileInf(FileVO fvo) throws Exception {
|
||||
delete("FileManageDAO.deleteFileDetail", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectFileInfs(FileVO vo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectFileList", vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 구분자에 대한 최대값을 구한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int getMaxFileSN(FileVO fvo) throws Exception {
|
||||
return (Integer) select("FileManageDAO.getMaxFileSN", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일에 대한 상세정보를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public FileVO selectFileInf(FileVO fvo) throws Exception {
|
||||
return (FileVO) select("FileManageDAO.selectFileInf", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 전체 파일을 삭제한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void deleteAllFileInf(FileVO fvo) throws Exception {
|
||||
update("FileManageDAO.deleteCOMTNFILE", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectFileListByFileNm(FileVO fvo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectFileListByFileNm", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명 검색에 대한 목록 전체 건수를 조회한다.
|
||||
*
|
||||
* @param fvo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int selectFileListCntByFileNm(FileVO fvo) throws Exception {
|
||||
return (Integer) select("FileManageDAO.selectFileListCntByFileNm", fvo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param vo
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<FileVO> selectImageFileList(FileVO vo) throws Exception {
|
||||
return (List<FileVO>) list("FileManageDAO.selectImageFileList", vo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package egovframework.com.cmm.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import egovframework.com.cmm.LoginVO;
|
||||
|
||||
import egovframework.rte.fdl.string.EgovObjectUtil;
|
||||
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
/**
|
||||
* EgovUserDetails Helper 클래스
|
||||
*
|
||||
* @author sjyoon
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
* 2009.03.10 sjyoon 최초 생성
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovUserDetailsHelper {
|
||||
|
||||
/**
|
||||
* 인증된 사용자객체를 VO형식으로 가져온다.
|
||||
* @return Object - 사용자 ValueObject
|
||||
*/
|
||||
public static Object getAuthenticatedUser() {
|
||||
return (LoginVO)RequestContextHolder.getRequestAttributes().getAttribute("LoginVO", RequestAttributes.SCOPE_SESSION)==null ?
|
||||
new LoginVO() : (LoginVO) RequestContextHolder.getRequestAttributes().getAttribute("LoginVO", RequestAttributes.SCOPE_SESSION);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 인증된 사용자의 권한 정보를 가져온다.
|
||||
* 예) [ROLE_ADMIN, ROLE_USER, ROLE_A, ROLE_B, ROLE_RESTRICTED, IS_AUTHENTICATED_FULLY, IS_AUTHENTICATED_REMEMBERED, IS_AUTHENTICATED_ANONYMOUSLY]
|
||||
* @return List - 사용자 권한정보 목록
|
||||
*/
|
||||
public static List<String> getAuthorities() {
|
||||
List<String> listAuth = new ArrayList<String>();
|
||||
|
||||
if (EgovObjectUtil.isNull((LoginVO) RequestContextHolder.getRequestAttributes().getAttribute("LoginVO", RequestAttributes.SCOPE_SESSION))) {
|
||||
// log.debug("## authentication object is null!!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return listAuth;
|
||||
}
|
||||
|
||||
/**
|
||||
* 인증된 사용자 여부를 체크한다.
|
||||
* @return Boolean - 인증된 사용자 여부(TRUE / FALSE)
|
||||
*/
|
||||
public static Boolean isAuthenticated() {
|
||||
|
||||
if (EgovObjectUtil.isNull((LoginVO) RequestContextHolder.getRequestAttributes().getAttribute("LoginVO", RequestAttributes.SCOPE_SESSION))) {
|
||||
// log.debug("## authentication object is null!!");
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.springframework.beans.propertyeditors.CustomDateEditor;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.support.WebBindingInitializer;
|
||||
import org.springframework.web.context.request.WebRequest;
|
||||
|
||||
public class EgovBindingInitializer implements WebBindingInitializer {
|
||||
|
||||
|
||||
public void initBinder(WebDataBinder binder, WebRequest request) {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
dateFormat.setLenient(false);
|
||||
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, false));
|
||||
binder.registerCustomEditor(String.class, new StringTrimmerEditor(false));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import egovframework.rte.fdl.property.EgovPropertyService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 공통유틸리티성 작업을 위한 Controller 클래스
|
||||
* @author 공통 서비스 개발팀 JJY
|
||||
* @since 2009.03.02
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.02 JJY 최초 생성
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
public class EgovComUtlController {
|
||||
|
||||
/** EgovPropertyService */
|
||||
@Resource(name = "propertiesService")
|
||||
protected EgovPropertyService propertiesService;
|
||||
|
||||
/**
|
||||
* JSP 호출작업만 처리하는 공통 함수
|
||||
*/
|
||||
@RequestMapping(value="/EgovPageLink.do")
|
||||
public String moveToPage(@RequestParam("link") String linkPage,
|
||||
HttpSession session,
|
||||
@RequestParam(value="menuNo", required=false) String menuNo){
|
||||
String link = linkPage;
|
||||
// service 사용하여 리턴할 결과값 처리하는 부분은 생략하고 단순 페이지 링크만 처리함
|
||||
if (linkPage==null || linkPage.equals("")){
|
||||
link="cmm/egovError";
|
||||
}else{
|
||||
if(link.indexOf(",")>-1){
|
||||
link=link.substring(0,link.indexOf(","));
|
||||
}
|
||||
}
|
||||
// 선택된 메뉴정보를 세션으로 등록한다.
|
||||
if (menuNo!=null && !menuNo.equals("")){
|
||||
session.setAttribute("menuNo",menuNo);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* JSP 호출작업만 처리하는 공통 함수
|
||||
*/
|
||||
@RequestMapping(value="/EgovPageLink.action")
|
||||
public String moveToPage_action(@RequestParam("link") String linkPage){
|
||||
String link = linkPage;
|
||||
// service 사용하여 리턴할 결과값 처리하는 부분은 생략하고 단순 페이지 링크만 처리함
|
||||
if (linkPage==null || linkPage.equals("")){
|
||||
link="cmm/egovError";
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
/**
|
||||
* validation rule dynamic java script
|
||||
*/
|
||||
@RequestMapping("/validator.do")
|
||||
public String validate(){
|
||||
return "cmm/validator";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,202 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 파일 다운로드를 위한 컨트롤러 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.25 이삼섭 최초 생성
|
||||
*
|
||||
* Copyright (C) 2009 by MOPAS All right reserved.
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
public class EgovFileDownloadController {
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovFileDownloadController.class);
|
||||
|
||||
/**
|
||||
* 브라우저 구분 얻기.
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposition 지정하기.
|
||||
*
|
||||
* @param filename
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
String browser = getBrowser(request);
|
||||
|
||||
String dispositionPrefix = "attachment; filename=";
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(filename, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(filename.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < filename.length(); i++) {
|
||||
char c = filename.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
} else {
|
||||
//throw new RuntimeException("Not supported browser");
|
||||
throw new IOException("Not supported browser");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename);
|
||||
|
||||
if ("Opera".equals(browser)) {
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일로 등록된 파일에 대하여 다운로드를 제공한다.
|
||||
*
|
||||
* @param commandMap
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(value = "/cmm/fms/FileDown.do",method = RequestMethod.POST)
|
||||
public void cvplFileDownload(@RequestParam Map<String, Object> commandMap, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
String atchFileId = (String) commandMap.get("atchFileId");
|
||||
String fileSn = (String) commandMap.get("fileSn");
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
|
||||
if (isAuthenticated) {
|
||||
|
||||
FileVO fileVO = new FileVO();
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
fileVO.setFileSn(fileSn);
|
||||
FileVO fvo = fileService.selectFileInf(fileVO);
|
||||
|
||||
File uFile = new File(fvo.getFileStreCours(), fvo.getStreFileNm());
|
||||
long fSize = uFile.length();
|
||||
|
||||
if (fSize > 0) {
|
||||
String mimetype = "application/x-msdownload";
|
||||
|
||||
//response.setBufferSize(fSize); // OutOfMemeory 발생
|
||||
response.setContentType(mimetype);
|
||||
//response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fvo.getOrignlFileNm(), "utf-8") + "\"");
|
||||
setDisposition(fvo.getOrignlFileNm(), request, response);
|
||||
//response.setContentLength(fSize);
|
||||
|
||||
/*
|
||||
* FileCopyUtils.copy(in, response.getOutputStream());
|
||||
* in.close();
|
||||
* response.getOutputStream().flush();
|
||||
* response.getOutputStream().close();
|
||||
*/
|
||||
BufferedInputStream in = null;
|
||||
BufferedOutputStream out = null;
|
||||
|
||||
try {
|
||||
in = new BufferedInputStream(new FileInputStream(uFile));
|
||||
out = new BufferedOutputStream(response.getOutputStream());
|
||||
|
||||
FileCopyUtils.copy(in, out);
|
||||
out.flush();
|
||||
} catch (Exception ex) {
|
||||
// 다음 Exception 무시 처리
|
||||
// Connection reset by peer: socket write error
|
||||
LOGGER.debug("IGNORED: {}", ex.getMessage());
|
||||
} finally {
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
if (out != null) {
|
||||
try {
|
||||
out.close();
|
||||
} catch (Exception ignore) {
|
||||
LOGGER.debug("IGNORED: {}", ignore.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
response.setContentType("application/x-msdownload");
|
||||
|
||||
PrintWriter printwriter = response.getWriter();
|
||||
printwriter.println("<html>");
|
||||
printwriter.println("<br><br><br><h2>Could not get file name:<br>" + fvo.getOrignlFileNm() + "</h2>");
|
||||
printwriter.println("<br><br><br><center><h3><a href='javascript: history.go(-1)'>Back</a></h3></center>");
|
||||
printwriter.println("<br><br><br>© webAccess");
|
||||
printwriter.println("</html>");
|
||||
printwriter.flush();
|
||||
printwriter.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
import egovframework.com.cmm.util.EgovUserDetailsHelper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 파일 조회, 삭제, 다운로드 처리를 위한 컨트롤러 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.25 이삼섭 최초 생성
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Controller
|
||||
public class EgovFileMngController {
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
/**
|
||||
* 첨부파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectFileInfs.do")
|
||||
public String selectFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap, ModelMap model) throws Exception {
|
||||
String atchFileId = (String)commandMap.get("param_atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
model.addAttribute("updateFlag", "N");
|
||||
model.addAttribute("fileListCnt", result.size());
|
||||
model.addAttribute("atchFileId", atchFileId);
|
||||
|
||||
return "cmm/fms/EgovFileList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일 변경을 위한 수정페이지로 이동한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectFileInfsForUpdate.do")
|
||||
public String selectFileInfsForUpdate(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
String atchFileId = (String)commandMap.get("param_atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
|
||||
List<FileVO> result = fileService.selectFileInfs(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
model.addAttribute("updateFlag", "Y");
|
||||
model.addAttribute("fileListCnt", result.size());
|
||||
model.addAttribute("atchFileId", atchFileId);
|
||||
|
||||
return "cmm/fms/EgovFileList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 첨부파일에 대한 삭제를 처리한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param returnUrl
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/deleteFileInfs.do")
|
||||
public String deleteFileInf(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam("returnUrl") String returnUrl,
|
||||
HttpServletRequest request,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
|
||||
|
||||
if (isAuthenticated) {
|
||||
fileService.deleteFileInf(fileVO);
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// contextRoot가 있는 경우 제외 시켜야 함
|
||||
//--------------------------------------------
|
||||
////return "forward:/cmm/fms/selectFileInfs.do";
|
||||
//return "forward:" + returnUrl;
|
||||
|
||||
if ("".equals(request.getContextPath()) || "/".equals(request.getContextPath())) {
|
||||
return "forward:" + returnUrl;
|
||||
}
|
||||
|
||||
if (returnUrl.startsWith(request.getContextPath())) {
|
||||
return "forward:" + returnUrl.substring(returnUrl.indexOf("/", 1));
|
||||
} else {
|
||||
return "forward:" + returnUrl;
|
||||
}
|
||||
////------------------------------------------
|
||||
}
|
||||
|
||||
/**
|
||||
* 이미지 첨부파일에 대한 목록을 조회한다.
|
||||
*
|
||||
* @param fileVO
|
||||
* @param atchFileId
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping("/cmm/fms/selectImageFileInfs.do")
|
||||
public String selectImageFileInfs(@ModelAttribute("searchVO") FileVO fileVO, @RequestParam Map<String, Object> commandMap,
|
||||
ModelMap model) throws Exception {
|
||||
|
||||
String atchFileId = (String)commandMap.get("atchFileId");
|
||||
|
||||
fileVO.setAtchFileId(atchFileId);
|
||||
List<FileVO> result = fileService.selectImageFileList(fileVO);
|
||||
|
||||
model.addAttribute("fileList", result);
|
||||
|
||||
return "cmm/fms/EgovImgFileList";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,145 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.com.cmm.SessionVO;
|
||||
import egovframework.com.cmm.service.EgovFileMngService;
|
||||
import egovframework.com.cmm.service.FileVO;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
|
||||
/**
|
||||
* @Class Name : EgovImageProcessController.java
|
||||
* @Description :
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2009. 4. 2. 이삼섭
|
||||
* 2011.08.31. JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 4. 2.
|
||||
* @version
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class EgovImageProcessController extends HttpServlet {
|
||||
|
||||
/**
|
||||
* serialVersion UID
|
||||
*/
|
||||
private static final long serialVersionUID = -6339945210971171173L;
|
||||
|
||||
@Resource(name = "EgovFileMngService")
|
||||
private EgovFileMngService fileService;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(EgovImageProcessController.class);
|
||||
|
||||
/**
|
||||
* 첨부된 이미지에 대한 미리보기 기능을 제공한다.
|
||||
*
|
||||
* @param atchFileId
|
||||
* @param fileSn
|
||||
* @param sessionVO
|
||||
* @param model
|
||||
* @param response
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("resource")
|
||||
@RequestMapping("/cmm/fms/getImage.do")
|
||||
public void getImageInf(SessionVO sessionVO, ModelMap model, @RequestParam Map<String, Object> commandMap, HttpServletResponse response) throws Exception {
|
||||
|
||||
//@RequestParam("atchFileId") String atchFileId,
|
||||
//@RequestParam("fileSn") String fileSn,
|
||||
String atchFileId = (String)commandMap.get("atchFileId");
|
||||
String fileSn = (String)commandMap.get("fileSn");
|
||||
|
||||
FileVO vo = new FileVO();
|
||||
|
||||
vo.setAtchFileId(atchFileId);
|
||||
vo.setFileSn(fileSn);
|
||||
|
||||
FileVO fvo = fileService.selectFileInf(vo);
|
||||
|
||||
//String fileLoaction = fvo.getFileStreCours() + fvo.getStreFileNm();
|
||||
|
||||
File file = new File(fvo.getFileStreCours(), fvo.getStreFileNm());
|
||||
FileInputStream fis = null; new FileInputStream(file);
|
||||
|
||||
BufferedInputStream in = null;
|
||||
ByteArrayOutputStream bStream = null;
|
||||
try{
|
||||
fis = new FileInputStream(file);
|
||||
in = new BufferedInputStream(fis);
|
||||
bStream = new ByteArrayOutputStream();
|
||||
int imgByte;
|
||||
while ((imgByte = in.read()) != -1) {
|
||||
bStream.write(imgByte);
|
||||
}
|
||||
|
||||
String type = "";
|
||||
|
||||
if (fvo.getFileExtsn() != null && !"".equals(fvo.getFileExtsn())) {
|
||||
if ("jpg".equals(fvo.getFileExtsn().toLowerCase())) {
|
||||
type = "image/jpeg";
|
||||
} else {
|
||||
type = "image/" + fvo.getFileExtsn().toLowerCase();
|
||||
}
|
||||
type = "image/" + fvo.getFileExtsn().toLowerCase();
|
||||
|
||||
} else {
|
||||
LOGGER.debug("Image fileType is null.");
|
||||
}
|
||||
|
||||
response.setHeader("Content-Type", type);
|
||||
response.setContentLength(bStream.size());
|
||||
|
||||
bStream.writeTo(response.getOutputStream());
|
||||
|
||||
response.getOutputStream().flush();
|
||||
response.getOutputStream().close();
|
||||
|
||||
|
||||
}catch(Exception e){
|
||||
LOGGER.debug("{}", e);
|
||||
}finally{
|
||||
if (bStream != null) {
|
||||
try {
|
||||
bStream.close();
|
||||
} catch (Exception est) {
|
||||
LOGGER.debug("IGNORED: {}", est.getMessage());
|
||||
}
|
||||
}
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (Exception ei) {
|
||||
LOGGER.debug("IGNORED: {}", ei.getMessage());
|
||||
}
|
||||
}
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
} catch (Exception efis) {
|
||||
LOGGER.debug("IGNORED: {}", efis.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package egovframework.com.cmm.web;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2006 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the ";License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS"; BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.commons.fileupload.FileItem;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.multipart.MultipartException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
|
||||
/**
|
||||
* 실행환경의 파일업로드 처리를 위한 기능 클래스
|
||||
* @author 공통서비스개발팀 이삼섭
|
||||
* @since 2009.06.01
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.3.25 이삼섭 최초 생성
|
||||
* 2011.06.11 서준식 스프링 3.0 업그레이드 API변경으로인한 수정
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public class EgovMultipartResolver extends CommonsMultipartResolver {
|
||||
public EgovMultipartResolver() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 첨부파일 처리를 위한 multipart resolver를 생성한다.
|
||||
*
|
||||
* @param servletContext
|
||||
*/
|
||||
public EgovMultipartResolver(ServletContext servletContext) {
|
||||
super(servletContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* multipart에 대한 parsing을 처리한다.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
protected MultipartParsingResult parseFileItems(List fileItems, String encoding) {
|
||||
|
||||
//스프링 3.0변경으로 수정한 부분
|
||||
MultiValueMap<String, MultipartFile> multipartFiles = new LinkedMultiValueMap<String, MultipartFile>();
|
||||
Map<String, String[]> multipartParameters = new HashMap<String, String[]>();
|
||||
|
||||
// Extract multipart files and multipart parameters.
|
||||
for (Iterator<?> it = fileItems.iterator(); it.hasNext();) {
|
||||
FileItem fileItem = (FileItem)it.next();
|
||||
|
||||
if (fileItem.isFormField()) {
|
||||
|
||||
String value = null;
|
||||
if (encoding != null) {
|
||||
try {
|
||||
value = fileItem.getString(encoding);
|
||||
} catch (UnsupportedEncodingException ex) {
|
||||
if (logger.isWarnEnabled()) {
|
||||
logger.warn("Could not decode multipart item '" + fileItem.getFieldName() + "' with encoding '" + encoding
|
||||
+ "': using platform default");
|
||||
}
|
||||
value = fileItem.getString();
|
||||
}
|
||||
} else {
|
||||
value = fileItem.getString();
|
||||
}
|
||||
String[] curParam = multipartParameters.get(fileItem.getFieldName());
|
||||
if (curParam == null) {
|
||||
// simple form field
|
||||
multipartParameters.put(fileItem.getFieldName(), new String[] { value });
|
||||
} else {
|
||||
// array of simple form fields
|
||||
String[] newParam = StringUtils.addStringToArray(curParam, value);
|
||||
multipartParameters.put(fileItem.getFieldName(), newParam);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (fileItem.getSize() > 0) {
|
||||
// multipart file field
|
||||
CommonsMultipartFile file = new CommonsMultipartFile(fileItem);
|
||||
|
||||
|
||||
//스프링 3.0 업그레이드 API변경으로인한 수정
|
||||
List<MultipartFile> fileList = new ArrayList<MultipartFile>();
|
||||
fileList.add(file);
|
||||
|
||||
|
||||
if (multipartFiles.put(fileItem.getName(), fileList) != null) { // CHANGED!!
|
||||
throw new MultipartException("Multiple files for field name [" + file.getName()
|
||||
+ "] found - not supported by MultipartResolver");
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Found multipart file [" + file.getName() + "] of size " + file.getSize() + " bytes with original filename ["
|
||||
+ file.getOriginalFilename() + "], stored " + file.getStorageDescription());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return new MultipartParsingResult(multipartFiles, multipartParameters, null);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package gtpa.brs.bbsfro.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : jackt
|
||||
* Date : 27/05/2019
|
||||
* TIME : 9:34 AM
|
||||
* Project : brspw
|
||||
* Class : BbsFroService
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public interface BbsFroService {
|
||||
//알려드립니다
|
||||
public List getNoticeList(Map param);
|
||||
|
||||
public Map getNoticeCnt(Map param);
|
||||
|
||||
public Map getNoticeDetail(Map param);
|
||||
|
||||
public Map noticeInsert(Map param);
|
||||
|
||||
public Map noticeUpdate(Map param);
|
||||
|
||||
public Map noticeDelete(Map param);
|
||||
|
||||
//자주찾는 질문
|
||||
public List getQsearchList(Map param);
|
||||
|
||||
public Map getQsearchCnt(Map param);
|
||||
|
||||
public Map getQsearchDetail(Map param);
|
||||
|
||||
public Map qsearchInsert(Map param);
|
||||
|
||||
public Map qsearchUpdate(Map param);
|
||||
|
||||
public Map qsearchDelete(Map param);
|
||||
|
||||
//자료실
|
||||
public List getFileRegistList(Map param);
|
||||
|
||||
public Map getFileRegistCnt(Map param);
|
||||
|
||||
public Map getFileRegistDetail(Map param);
|
||||
|
||||
public Map fileRegistInsert(Map param);
|
||||
|
||||
public Map fileRegistUpdate(Map param);
|
||||
|
||||
public Map fileRegistDelete(Map param);
|
||||
|
||||
//파일정보 -> 공통
|
||||
public List getFileDetailInfo(Map param);
|
||||
|
||||
public Map fileDownload(Map param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,154 @@
|
||||
package gtpa.brs.bbsfro.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : jackt
|
||||
* <p>
|
||||
* Date : 27/05/2019
|
||||
* TIME : 9:34 AM
|
||||
* Project : brspw
|
||||
* Class : BbsFroMapper
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Repository("bbsFroDao")
|
||||
public class BbsFroMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "BbsFroDao";
|
||||
|
||||
//알려드립니다
|
||||
public List getNoticeList(Map param) {
|
||||
return selectList(NAMESPACE + ".getNoticeList", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getNoticeCnt(Map param) {
|
||||
return selectOne(NAMESPACE + ".getNoticeCnt", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getNoticeDetail(Map param) {
|
||||
return selectOne(NAMESPACE + ".getNoticeDetail", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int noticeInsert(Map param) {
|
||||
return insert(NAMESPACE + ".noticeInsert", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int noticeUpdate(Map param) {
|
||||
return update(NAMESPACE + ".noticeUpdate", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int noticeDelete(Map param) {
|
||||
return update(NAMESPACE + ".noticeDelete", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
//자주찾는 질문
|
||||
public List getQsearchList(Map param) {
|
||||
return selectList(NAMESPACE + ".getQsearchList", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getQsearchCnt(Map param) {
|
||||
return selectOne(NAMESPACE + ".getQsearchCnt", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getQsearchDetail(Map param) {
|
||||
return selectOne(NAMESPACE + ".getQsearchDetail", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int qsearchInsert(Map param) {
|
||||
return insert(NAMESPACE + ".qsearchInsert", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int qsearchUpdate(Map param) {
|
||||
return update(NAMESPACE + ".qsearchUpdate", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int qsearchDelete(Map param) {
|
||||
return update(NAMESPACE + ".qsearchDelete", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
//자료실
|
||||
public List getFileRegistList(Map param) {
|
||||
return selectList(NAMESPACE + ".getFileRegistList", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getFileRegistCnt(Map param) {
|
||||
return selectOne(NAMESPACE + ".getFileRegistCnt", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map getFileRegistDetail(Map param) {
|
||||
return selectOne(NAMESPACE + ".getFileRegistDetail", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int fileRegistInsert(Map param) {
|
||||
return insert(NAMESPACE + ".fileRegistInsert", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int fileRegistUpdate(Map param) {
|
||||
return update(NAMESPACE + ".fileRegistUpdate", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public int fileRegistDelete(Map param) {
|
||||
return update(NAMESPACE + ".fileRegistDelete", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
//파일정보 -> 공통
|
||||
public List getFileDetailInfo(Map param) {
|
||||
return selectList(NAMESPACE + ".getFileDetailInfo", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public Map fileDownload(Map param) {
|
||||
return selectOne(NAMESPACE + ".fileDownload", param);
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,212 @@
|
||||
package gtpa.brs.bbsfro.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import gtpa.brs.bbsfro.service.BbsFroService;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : jackt
|
||||
* Date : 27/05/2019
|
||||
* TIME : 9:34 AM
|
||||
* Project : brspw
|
||||
* Class : BbsFroServiceImpl
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Service
|
||||
public class BbsFroServiceImpl implements BbsFroService {
|
||||
|
||||
@Resource(name = "bbsFroDao")
|
||||
private BbsFroMapper bbsFroMapper;
|
||||
|
||||
//알려드립니다
|
||||
@Override
|
||||
public List getNoticeList(Map param) {
|
||||
List rs = null;
|
||||
rs = bbsFroMapper.getNoticeList(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getNoticeCnt(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getNoticeCnt(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getNoticeDetail(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getNoticeDetail(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map noticeInsert(Map param) {
|
||||
int iCnt = 0;
|
||||
iCnt = bbsFroMapper.noticeInsert(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("ICNT", String.valueOf(iCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map noticeUpdate(Map param) {
|
||||
int uCnt = 0;
|
||||
uCnt = bbsFroMapper.noticeUpdate(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("UCNT", String.valueOf(uCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map noticeDelete(Map param) {
|
||||
int dCnt = 0;
|
||||
dCnt = bbsFroMapper.noticeDelete(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("DCNT", String.valueOf(dCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
//자주찾는 질문
|
||||
@Override
|
||||
public List getQsearchList(Map param) {
|
||||
List rs = null;
|
||||
rs = bbsFroMapper.getQsearchList(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getQsearchCnt(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getQsearchCnt(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getQsearchDetail(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getQsearchDetail(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map qsearchInsert(Map param) {
|
||||
int iCnt = 0;
|
||||
iCnt = bbsFroMapper.qsearchInsert(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("ICNT", String.valueOf(iCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map qsearchUpdate(Map param) {
|
||||
int uCnt = 0;
|
||||
uCnt = bbsFroMapper.qsearchUpdate(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("UCNT", String.valueOf(uCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map qsearchDelete(Map param) {
|
||||
int dCnt = 0;
|
||||
dCnt = bbsFroMapper.qsearchDelete(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("DCNT", String.valueOf(dCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//자료실
|
||||
@Override
|
||||
public List getFileRegistList(Map param) {
|
||||
List rs = null;
|
||||
rs = bbsFroMapper.getFileRegistList(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getFileRegistCnt(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getFileRegistCnt(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getFileRegistDetail(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.getFileRegistDetail(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map fileRegistInsert(Map param) {
|
||||
int iCnt = 0;
|
||||
iCnt = bbsFroMapper.fileRegistInsert(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("ICNT", String.valueOf(iCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map fileRegistUpdate(Map param) {
|
||||
int uCnt = 0;
|
||||
uCnt = bbsFroMapper.fileRegistUpdate(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("UCNT", String.valueOf(uCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map fileRegistDelete(Map param) {
|
||||
int dCnt = 0;
|
||||
dCnt = bbsFroMapper.fileRegistDelete(param);
|
||||
|
||||
Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("DCNT", String.valueOf(dCnt));
|
||||
return result;
|
||||
}
|
||||
|
||||
//파일정보 -> 공통
|
||||
@Override
|
||||
public List getFileDetailInfo(Map param) {
|
||||
List rs = null;
|
||||
rs = bbsFroMapper.getFileDetailInfo(param);
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map fileDownload(Map param) {
|
||||
Map rs = null;
|
||||
rs = bbsFroMapper.fileDownload(param);
|
||||
return rs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,331 @@
|
||||
package gtpa.brs.bbsfro.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
|
||||
import gtpa.brs.bbsfro.service.BbsFroService;
|
||||
import gtpa.brs.common.web.BaseController;
|
||||
import gtpa.brs.util.Result;
|
||||
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : jackt
|
||||
* Date : 27/05/2019
|
||||
* TIME : 11:30 AM
|
||||
* Project : brspw
|
||||
* Class : BbsFroController
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Controller
|
||||
public class BbsFroController extends BaseController{
|
||||
private Logger logger = LoggerFactory.getLogger(BbsFroController.class);
|
||||
|
||||
@Autowired
|
||||
BbsFroService bbsFroService;
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
private Properties env;
|
||||
|
||||
// 알려드립니다 목록
|
||||
@RequestMapping(value = "/bbsfro/getNoticeList.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getNoticeList(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_searchParm");
|
||||
|
||||
result.setData("TOTAL_CNT", bbsFroService.getNoticeCnt(dbParam));
|
||||
result.setData("dlt_resultList", bbsFroService.getNoticeList(dbParam));
|
||||
|
||||
logger.info("Result Data List: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 알려드립니다 상세
|
||||
@RequestMapping(value = "/bbsfro/getNoticeDetail.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getNoticeDetail(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_param");
|
||||
result.setData("dma_result", bbsFroService.getNoticeDetail(dbParam));
|
||||
|
||||
logger.info("Result Data Detail: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 자주찾는질문 목록
|
||||
@RequestMapping(value = "/bbsfro/getQsearchList.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getQsearchList(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_searchParm");
|
||||
|
||||
result.setData("TOTAL_CNT", bbsFroService.getQsearchCnt(dbParam));
|
||||
result.setData("dlt_resultList", bbsFroService.getQsearchList(dbParam));
|
||||
|
||||
logger.info("Result Data List: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 자주찾는질문 상세
|
||||
@RequestMapping(value = "/bbsfro/getQsearchDetail.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getQsearchDetail(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_param");
|
||||
result.setData("dma_result", bbsFroService.getQsearchDetail(dbParam));
|
||||
|
||||
logger.info("Result Data Detail: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 자료실 목록
|
||||
@RequestMapping(value = "/bbsfro/getFileRegistList.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getFileRegistList(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_searchParm");
|
||||
|
||||
result.setData("TOTAL_CNT", bbsFroService.getFileRegistCnt(dbParam));
|
||||
result.setData("dlt_resultList", bbsFroService.getFileRegistList(dbParam));
|
||||
|
||||
logger.info("Result Data List: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 자료실 상세
|
||||
@RequestMapping(value = "/bbsfro/getFileRegistDetail.do",method = RequestMethod.POST)
|
||||
public @ResponseBody Map<String, Object> getFileRegistDetail(@RequestBody Map<String, Object> param) {
|
||||
|
||||
Result result = new Result();
|
||||
try {
|
||||
logger.info("====#####== POST =======");
|
||||
logger.info("Param Data : " + param);
|
||||
|
||||
Map dbParam = (Map) param.get("dma_param");
|
||||
Map fileRegDetail = bbsFroService.getFileRegistDetail(dbParam);
|
||||
result.setData("dma_result", fileRegDetail);
|
||||
|
||||
String fileType = StringUtils.defaultIfBlank((String)fileRegDetail.get("ATCH_FILE_TY"), "");
|
||||
if(!"".equals(fileType)) {
|
||||
dbParam.put("ATCH_FILE_ID",fileRegDetail.get("ATCH_FILE_ID"));
|
||||
if("01".equals(fileType)) {
|
||||
dbParam.put("ATCH_FILE_TY","SY");
|
||||
}else {
|
||||
dbParam.put("ATCH_FILE_TY","SN");
|
||||
}
|
||||
//dbParam.put("ATCH_FILE_TY",fileRegDetail.get("ATCH_FILE_TY"));
|
||||
List fileList = bbsFroService.getFileDetailInfo(dbParam);
|
||||
result.setData("dlt_orgFileList", fileList);
|
||||
}
|
||||
|
||||
logger.info("Result Data Detail: " + result.getResult());
|
||||
result.setMsg(result.STATUS_SUCESS, "정상적으로 죄회되었습니다.");
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", re);
|
||||
} catch (Exception ex) {
|
||||
logger.error("[Exception::" + "" + "]", ex);
|
||||
result.setMsg(result.STATUS_ERROR, "조회시 에러가 발생하였습니다.", ex);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
// 게시판용 파일다운로드
|
||||
@RequestMapping(value = "/bbs/fileDownload.do",method = RequestMethod.GET)
|
||||
public void getFileDownload(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
logger.info("====#####== POST fileDownload =======");
|
||||
// fileId를 이용해서 DB에서 serverFileName, localFileName과 fileDir를 가져와야 한다.
|
||||
String fileId = request.getParameter("fileId");
|
||||
String atchFileTy = request.getParameter("atchFileTy");
|
||||
String fileSeq = request.getParameter("fileSeq");
|
||||
Map param = new HashMap();
|
||||
param.put("ATCH_FILE_ID", fileId);
|
||||
param.put("ATCH_FILE_TY", atchFileTy);
|
||||
if (fileSeq == null) fileSeq = "0";
|
||||
param.put("FILE_SEQ_NO", fileSeq);
|
||||
Map fileInfo = bbsFroService.fileDownload(param);
|
||||
logger.info("fileInfo::" + fileInfo);
|
||||
|
||||
String browser = getBrowser(request);
|
||||
logger.info("browser::" + browser);
|
||||
if (fileInfo != null) {
|
||||
String serverFileName = (String) fileInfo.get("STRE_FILE_NM");
|
||||
String localFileName = (String) fileInfo.get("ORGINL_FILE_NM");
|
||||
String fileDir = (String) fileInfo.get("FILE_STRE_PATH_NM");
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(localFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(localFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(localFileName.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(localFileName.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < localFileName.length(); i++) {
|
||||
char c = localFileName.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
}
|
||||
|
||||
Path file = Paths.get(fileDir, serverFileName);
|
||||
|
||||
if (Files.exists(file)) {
|
||||
response.setContentType("application/octet-stream;");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + encodedFilename);
|
||||
try {
|
||||
logger.info("file::" + file);
|
||||
Files.copy(file, response.getOutputStream());
|
||||
response.getOutputStream().flush();
|
||||
} catch (IOException ex) {
|
||||
logger.error("[process error::"+"ex.getMessage()" + "]",ex);
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::"+ "" + "]",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 브라우저 구분 얻기.
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package gtpa.brs.common.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 1:30 PM
|
||||
* Project : BRSPW
|
||||
* Class : CommonService
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public interface CommonService {
|
||||
List<Map> getCommonCode();
|
||||
|
||||
List<Map> getCommonCode(Map param);
|
||||
|
||||
Map fileDownload(Map param);
|
||||
|
||||
List<Map> exsistNoticePopups() throws SQLException;
|
||||
|
||||
Map exsistNoticePopup(Map param) throws SQLException;
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package gtpa.brs.common.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 1:33 PM
|
||||
* Project : BRSPW
|
||||
* Class : CommonMapper
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Repository("commonDao")
|
||||
public class CommonMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "CommonDAO";
|
||||
|
||||
public List<Map> getCommonCode() {
|
||||
return selectList(NAMESPACE + ".getAllCommonCode");
|
||||
}
|
||||
|
||||
public List<Map> getCommonCode(Map param) {
|
||||
return selectList(NAMESPACE + ".getCommonCode", param);
|
||||
}
|
||||
|
||||
public Map fileDownload(Map param) {
|
||||
return selectOne(NAMESPACE + ".fileDownload", param);
|
||||
}
|
||||
|
||||
public List<Map> exsistNoticePopups() throws SQLException {
|
||||
return selectList(NAMESPACE + ".exsistNoticePopups");
|
||||
}
|
||||
|
||||
public Map exsistNoticePopup(Map param) throws SQLException {
|
||||
return selectOne(NAMESPACE + ".exsistNoticePopup", param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package gtpa.brs.common.service.impl;
|
||||
|
||||
import gtpa.brs.common.service.CommonService;
|
||||
import gtpa.brs.common.service.impl.CommonMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 1:32 PM
|
||||
* Project : BRSPW
|
||||
* Class : CommonServiceImpl
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Service("commonService")
|
||||
public class CommonServiceImpl implements CommonService {
|
||||
|
||||
@Resource(name = "commonDao")
|
||||
CommonMapper commonMapper;
|
||||
|
||||
@Override
|
||||
public List<Map> getCommonCode() {
|
||||
return commonMapper.getCommonCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getCommonCode(Map param) {
|
||||
return commonMapper.getCommonCode(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map fileDownload(Map param) {
|
||||
return commonMapper.fileDownload(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> exsistNoticePopups() throws SQLException {
|
||||
return commonMapper.exsistNoticePopups();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map exsistNoticePopup(Map param) throws SQLException{
|
||||
return commonMapper.exsistNoticePopup(param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package gtpa.brs.common.web;
|
||||
|
||||
import java.util.Enumeration;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.MessageSource;
|
||||
|
||||
@SuppressFBWarnings
|
||||
public class BaseController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(BaseController.class);
|
||||
|
||||
@Autowired
|
||||
protected MessageSource messageSource;
|
||||
|
||||
public void printRequest(HttpServletRequest pReq) {
|
||||
|
||||
Enumeration<?> eParam = pReq.getParameterNames();
|
||||
while (eParam.hasMoreElements()) {
|
||||
String pName = (String) eParam.nextElement();
|
||||
String pValue = pReq.getParameter(pName);
|
||||
|
||||
logger.info("#### RequestParamMap = " + pName + " : " + pValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,333 @@
|
||||
package gtpa.brs.common.web;
|
||||
|
||||
import gtpa.brs.common.service.CommonService;
|
||||
import gtpa.brs.util.Result;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.InputStreamResource;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.*;
|
||||
|
||||
import javax.activation.MimetypesFileTypeMap;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 1:30 PM
|
||||
* Project : BRSPW
|
||||
* Class : CommonController
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Controller
|
||||
public class CommonController {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(CommonController.class);
|
||||
/**
|
||||
* The Common service.
|
||||
*/
|
||||
@Autowired
|
||||
CommonService commonService;
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
private Properties env;
|
||||
|
||||
/**
|
||||
* Get common code result.
|
||||
*
|
||||
* @return the result
|
||||
*/
|
||||
@RequestMapping(value = "/common/getCommonCode.do", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
Result getCommonCode() {
|
||||
Result result = new Result();
|
||||
List<Map> codeList = new ArrayList<>();
|
||||
try {
|
||||
codeList = commonService.getCommonCode();
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
} finally {
|
||||
result.setData("code", codeList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get common code result.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the result
|
||||
*/
|
||||
@RequestMapping(value = "/common/getCommonCode.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Result getCommonCode(@RequestBody Map<String, Object> param) {
|
||||
Result result = new Result();
|
||||
List<Map> codeList = new ArrayList<>();
|
||||
Map<String, Object> params = (Map) param.get("param");
|
||||
try {
|
||||
codeList = commonService.getCommonCode(params);
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
} finally {
|
||||
result.setData("code", codeList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/fileDownload.do", method = RequestMethod.GET)
|
||||
public void getFileDownload(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
// fileId를 이용해서 DB에서 serverFileName, localFileName과 fileDir를 가져와야 한다.
|
||||
String fileId = request.getParameter("fileId");
|
||||
String atchFileTy = request.getParameter("atchFileTy");
|
||||
String fileSeq = request.getParameter("fileSeq");
|
||||
Map param = new HashMap();
|
||||
param.put("ATCH_FILE_ID", fileId);
|
||||
param.put("ATCH_FILE_TY", atchFileTy);
|
||||
if (fileSeq == null) fileSeq = "0";
|
||||
param.put("FILE_SEQ_NO", fileSeq);
|
||||
Map fileInfo = commonService.fileDownload(param);
|
||||
|
||||
String browser = getBrowser(request);
|
||||
logger.info("browser::" + browser);
|
||||
if (fileInfo != null) {
|
||||
String serverFileName = (String) fileInfo.get("STRE_FILE_NM");
|
||||
String localFileName = (String) fileInfo.get("ORGINL_FILE_NM");
|
||||
String fileDir = (String) fileInfo.get("FILE_STRE_PATH_NM");
|
||||
String encodedFilename = null;
|
||||
|
||||
if (browser.equals("MSIE")) {
|
||||
encodedFilename = URLEncoder.encode(localFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Trident")) { // IE11 문자열 깨짐 방지
|
||||
encodedFilename = URLEncoder.encode(localFileName, "UTF-8").replaceAll("\\+", "%20");
|
||||
} else if (browser.equals("Firefox")) {
|
||||
encodedFilename = "\"" + new String(localFileName.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Opera")) {
|
||||
encodedFilename = "\"" + new String(localFileName.getBytes("UTF-8"), "8859_1") + "\"";
|
||||
} else if (browser.equals("Chrome")) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < localFileName.length(); i++) {
|
||||
char c = localFileName.charAt(i);
|
||||
if (c > '~') {
|
||||
sb.append(URLEncoder.encode("" + c, "UTF-8"));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
encodedFilename = sb.toString();
|
||||
}
|
||||
|
||||
Path file = Paths.get(fileDir, serverFileName);
|
||||
|
||||
if (Files.exists(file)) {
|
||||
response.setContentType("application/octet-stream;");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + encodedFilename);
|
||||
try {
|
||||
Files.copy(file, response.getOutputStream());
|
||||
response.getOutputStream().flush();
|
||||
} catch (IOException ex) {
|
||||
logger.error("[process error::" + "ex.getMessage()" + "]", ex);
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/fileDownloadTmp.do", method = RequestMethod.GET)
|
||||
public void getFileDownloadTmp(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
try {
|
||||
// fileId를 이용해서 DB에서 serverFileName, localFileName과 fileDir를 가져와야 한다.
|
||||
String fileId = request.getParameter("fileId");
|
||||
String atchFileTy = request.getParameter("atchFileTy");
|
||||
String fileSeq = request.getParameter("fileSeq");
|
||||
Map param = new HashMap();
|
||||
param.put("ATCH_FILE_ID", fileId);
|
||||
param.put("ATCH_FILE_TY", atchFileTy);
|
||||
if (fileSeq == null) fileSeq = "0";
|
||||
param.put("FILE_SEQ_NO", fileSeq);
|
||||
Map fileInfo = commonService.fileDownload(param);
|
||||
if (fileInfo != null) {
|
||||
String serverFileName = (String) fileInfo.get("STRE_FILE_NM");
|
||||
String localFileName = (String) fileInfo.get("ORGINL_FILE_NM");
|
||||
String fileDir = (String) fileInfo.get("FILE_STRE_PATH_NM");
|
||||
|
||||
Path file = Paths.get(fileDir, serverFileName);
|
||||
|
||||
if (Files.exists(file)) {
|
||||
response.setContentType("application/octet-stream;");
|
||||
response.addHeader("Content-Disposition", "attachment; filename=" + localFileName);
|
||||
try {
|
||||
Files.copy(file, response.getOutputStream());
|
||||
response.getOutputStream().flush();
|
||||
} catch (IOException ex) {
|
||||
logger.error("[process error::" + "ex.getMessage()" + "]", ex);
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} else {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
response.getWriter().print("<html><script>alert('해당파일이 존재하지 않습니다.');</script></html>");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/imageView.do", method = RequestMethod.GET, produces = {MediaType.IMAGE_PNG_VALUE, MediaType.IMAGE_GIF_VALUE, MediaType.IMAGE_JPEG_VALUE})
|
||||
public @ResponseBody
|
||||
ResponseEntity getImage(@RequestParam("fileName") String fileName) throws IOException {
|
||||
InputStream inputStream = null;
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
byte[] out = new byte[0];
|
||||
try {
|
||||
if (fileName == null || "".equals(fileName)) {
|
||||
logger.error("fileName null ::" + fileName);
|
||||
return ResponseEntity.badRequest().contentLength(0).build();
|
||||
} else {
|
||||
fileName = fileName.replaceAll("\\\\", "");
|
||||
fileName = fileName.replaceAll("\\.\\.", "");
|
||||
}
|
||||
String extension = FilenameUtils.getExtension(fileName);
|
||||
String path = FilenameUtils.getPrefix(fileName) + FilenameUtils.getPath(fileName);
|
||||
String name = FilenameUtils.getBaseName(fileName);
|
||||
|
||||
File file = new File(path, name + "." + extension);
|
||||
//File file = new File("/"+FilenameUtils.getPath(fileName),FilenameUtils.getName(fileName)); //Fix
|
||||
//File file = new File(env.getProperty("Globals.FilePath"),FilenameUtils.getName(fileName)); //Fix
|
||||
if (file.exists()) {
|
||||
inputStream = new FileInputStream(path + name + "." + extension);
|
||||
MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
|
||||
String type = mimeTypesMap.getContentType(file);
|
||||
out = IOUtils.toByteArray(inputStream);
|
||||
responseHeaders.add("Content-Type", type);
|
||||
|
||||
} else {
|
||||
logger.error("file not exsist ::" + fileName);
|
||||
return ResponseEntity.ok().contentLength(0).build();
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
return ResponseEntity.notFound().build();
|
||||
} catch (Exception e) {
|
||||
logger.error("Exception ::" + fileName);
|
||||
return ResponseEntity.notFound().build();
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException io) {
|
||||
logger.warn("inputStream close error");
|
||||
}
|
||||
return new ResponseEntity(out, responseHeaders, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 브라우저 구분 얻기.
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private String getBrowser(HttpServletRequest request) {
|
||||
String header = request.getHeader("User-Agent");
|
||||
if (header.indexOf("MSIE") > -1) {
|
||||
return "MSIE";
|
||||
} else if (header.indexOf("Trident") > -1) { // IE11 문자열 깨짐 방지
|
||||
return "Trident";
|
||||
} else if (header.indexOf("Chrome") > -1) {
|
||||
return "Chrome";
|
||||
} else if (header.indexOf("Opera") > -1) {
|
||||
return "Opera";
|
||||
}
|
||||
return "Firefox";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/exsistNoticePopup.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Map exsistNoticePopup(@RequestBody Map<String, Object> param) {
|
||||
Result result = new Result();
|
||||
Map<String, Object> params = (Map) param.get("param");
|
||||
try {
|
||||
if (params != null && params.get("NOTICE_SEQ_NO") != null) {
|
||||
Map popup = commonService.exsistNoticePopup(params);
|
||||
if (popup != null) {
|
||||
result.setData("popup", popup);
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCCESS_NODATA, result.STATUS_SUCCESS_NODATA_MESSAGE);
|
||||
}
|
||||
} else {
|
||||
List<Map> popupList = commonService.exsistNoticePopups();
|
||||
if (popupList.size() > 0) {
|
||||
result.setData("popup", popupList);
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCCESS_NODATA, result.STATUS_SUCCESS_NODATA_MESSAGE);
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/moviePopup.do")
|
||||
public ModelAndView moviePopup (HttpServletRequest request, HttpServletResponse response) {
|
||||
String movieUrl = request.getParameter("movieUrl");
|
||||
if(movieUrl == null || movieUrl.equals("")){
|
||||
movieUrl = "none";
|
||||
}
|
||||
ModelAndView mv = new ModelAndView();
|
||||
mv.setViewName("popup/moviePopup");
|
||||
mv.addObject("movieUrl", movieUrl);
|
||||
return mv;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,204 @@
|
||||
package gtpa.brs.fee.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The interface Fee service.
|
||||
*/
|
||||
public interface FeeService {
|
||||
/**
|
||||
* Gets fee list.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the fee list
|
||||
*/
|
||||
Map getFeeList(Map param);
|
||||
|
||||
/**
|
||||
* Gets park fee list.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the park fee list
|
||||
*/
|
||||
Map getParkFeeList(Map param);
|
||||
|
||||
/**
|
||||
* Gets fees info.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the fees info
|
||||
*/
|
||||
Map getFeesInfo(Map param);
|
||||
|
||||
/**
|
||||
* Gets complaints list.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the complaints list
|
||||
*/
|
||||
Map getComplaintsList(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Gets complaint info.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the complaint info
|
||||
*/
|
||||
Map getComplaintInfo(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Gets complaint file info.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the complaint file info
|
||||
*/
|
||||
List<Map> getComplaintFileInfo(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Is exsist complaint info map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map isExsistComplaintInfo(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Submit a complaint map.
|
||||
*
|
||||
* @param complaintInfo the complaint info
|
||||
* @param files the files
|
||||
* @return the map
|
||||
*/
|
||||
Map submitAComplaint(Map<String, Object> complaintInfo, List files);
|
||||
|
||||
/**
|
||||
* Cancle a complaint map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map cancleAComplaint(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Submit a complaint reply map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map submitAComplaintReply(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Pay a fee map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map payAFee(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Modify a complaint map.
|
||||
*
|
||||
* @param complaintInfo the complaint info
|
||||
* @param files the files
|
||||
* @return the map
|
||||
*/
|
||||
Map modifyAComplaint(Map<String, Object> complaintInfo, List files);
|
||||
|
||||
/**
|
||||
* Modify a complaint file delete map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map modifyAComplaintFileDelete(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Modify a complaint file insert map.
|
||||
*
|
||||
* @param files the files
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map modifyAComplaintFileInsert(List files, Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Gets refnd list.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the refnd list
|
||||
*/
|
||||
Map getRefndList(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Gets refnd cnt.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the refnd cnt
|
||||
*/
|
||||
public Map getRefndCnt(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Gets refnd detail.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the refnd detail
|
||||
*/
|
||||
public Map getRefndDetail(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Refnd insert map.
|
||||
*
|
||||
* @param param1 the param 1
|
||||
* @param param2 the param 2
|
||||
* @return the map
|
||||
*/
|
||||
public Map refndInsert(Map<String, Object> param1, Map<String, Object> param2);
|
||||
|
||||
/**
|
||||
* Refnd update map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
public Map refndUpdate(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* Privach check api map.
|
||||
*
|
||||
* @param param the param
|
||||
* @param files the files
|
||||
* @return the map
|
||||
*/
|
||||
public Map privachCheckApi(Map<String, Object> param, List files);
|
||||
|
||||
/**
|
||||
* Refund privach check api map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
public Map refundPrivachCheckApi(Map<String, Object> param);
|
||||
|
||||
|
||||
/**
|
||||
* Gets recipt list.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the recipt list
|
||||
*/
|
||||
Map getReciptList(Map<String, Object> param);
|
||||
|
||||
Map getJmpTunnelFees(Map params);
|
||||
|
||||
Map getYdpParkFees(Map params);
|
||||
|
||||
Map getJgParkFees(Map params);
|
||||
|
||||
Map getSbgRoadFees(Map params);
|
||||
|
||||
Map getScgParkFees(Map params);
|
||||
|
||||
List getFeeData(Map dbParam);
|
||||
}
|
||||
@ -0,0 +1,131 @@
|
||||
package gtpa.brs.fee.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 20/05/2019
|
||||
* TIME : 5:49 PM
|
||||
* Project : BRSPW
|
||||
* Class : FeeMapper
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Repository("feeDao")
|
||||
public class FeeMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "FeeDAO";
|
||||
|
||||
|
||||
public List<Map> getComplaintsList(Map<String, Object> param) {
|
||||
return selectList(NAMESPACE + ".getComplaintsList", param);
|
||||
}
|
||||
|
||||
public Map getComplaintInfo(Map<String, Object> param) {
|
||||
return selectOne(NAMESPACE + ".getComplaintInfo", param);
|
||||
}
|
||||
|
||||
public List<Map> getComplaintFileInfo(Map<String, Object> param) {
|
||||
return selectList(NAMESPACE + ".getComplaintFileInfo", param);
|
||||
}
|
||||
|
||||
|
||||
public Map isExsistComplaintInfo(Map<String, Object> param) {
|
||||
return selectOne(NAMESPACE + ".isExsistComplaintInfo", param);
|
||||
}
|
||||
|
||||
public void submitAComplaintInfo(Map<String, Object> param) {
|
||||
insert(NAMESPACE + ".submitAComplaintInfo", param);
|
||||
}
|
||||
|
||||
public void submitAComplaintDetail(Map<String, Object> param) {
|
||||
insert(NAMESPACE + ".submitAComplaintDetail", param);
|
||||
}
|
||||
|
||||
public void submitAComplaintFile(List files) {
|
||||
insert(NAMESPACE + ".submitAComplaintFile", files.get(0));
|
||||
}
|
||||
|
||||
public void submitAComplaintFileMap(Map<String, Object> param) {
|
||||
insert(NAMESPACE + ".submitAComplaintFile", param);
|
||||
}
|
||||
|
||||
public void submitAComplaintFileDetail(List files) {
|
||||
insert(NAMESPACE + ".submitAComplaintFileDetail", files);
|
||||
}
|
||||
|
||||
public void modifyAComplaintInfo(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".modifyAComplaintInfo", param);
|
||||
}
|
||||
|
||||
public void modifyAComplaintDetail(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".modifyAComplaintDetail", param);
|
||||
}
|
||||
|
||||
public void modifyAComplaintFile(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".modifyAComplaintFile", param);
|
||||
}
|
||||
|
||||
public void modifyAComplaintFileDetail(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".modifyAComplaintFileDetail", param);
|
||||
}
|
||||
|
||||
public void cancleAComplaintInfo(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".cancleAComplaintInfo", param);
|
||||
}
|
||||
|
||||
public void cancleAComplaintDetail(Map<String, Object> param) {
|
||||
update(NAMESPACE + ".cancleAComplaintDetail", param);
|
||||
}
|
||||
|
||||
public void submitAComplaintReply(Map<String, Object> param) {
|
||||
insert(NAMESPACE + ".submitAComplaintReply", param);
|
||||
}
|
||||
|
||||
//환불정보
|
||||
public List<Map> getRefndList(Map<String, Object> param) {
|
||||
return selectList(NAMESPACE + ".getRefndList", param);
|
||||
}
|
||||
|
||||
|
||||
public Map getRefndCnt(Map<String, Object> param) {
|
||||
return selectOne(NAMESPACE + ".getRefndCnt", param);
|
||||
}
|
||||
|
||||
|
||||
public Map getRefndDetail(Map<String, Object> param) {
|
||||
return selectOne(NAMESPACE + ".getNoticeDetail", param);
|
||||
}
|
||||
|
||||
|
||||
public int refndUpdate(Map<String, Object> param) {
|
||||
return update(NAMESPACE + ".refndUpdate", param);
|
||||
}
|
||||
|
||||
public int atchfileInfoDelete(String fileId) {
|
||||
return update(NAMESPACE + ".atchfileInfoDelete", fileId);
|
||||
}
|
||||
|
||||
public int atchfileInfoInsert(String fileId) {
|
||||
return insert(NAMESPACE + ".atchfileInfoInsert", fileId);
|
||||
}
|
||||
|
||||
public int atchfileDetailInfoDelete(String fileId) {
|
||||
return update(NAMESPACE + ".atchfileDetailInfoDelete", fileId);
|
||||
}
|
||||
|
||||
public int atchfileDetailInfoInsert(Map<String, Object> param) {
|
||||
return insert(NAMESPACE + ".atchfileDetailInfoInsert", param);
|
||||
}
|
||||
|
||||
public List getFeeData(Map dbParam) {
|
||||
return selectList(NAMESPACE + ".getFeeData", dbParam);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -0,0 +1,45 @@
|
||||
package gtpa.brs.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 2:13 PM
|
||||
* Project : BRSPW
|
||||
* Class : ClobTypeHandler
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@MappedJdbcTypes(value = {JdbcType.CLOB})
|
||||
public class ClobTypeHandler extends BaseTypeHandler<String> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, String s, JdbcType jdbcType) throws SQLException {
|
||||
preparedStatement.setString(i, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, String s) throws SQLException {
|
||||
return resultSet.getString(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, int i) throws SQLException {
|
||||
return resultSet.getString(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
|
||||
return callableStatement.getString(i);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package gtpa.brs.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 23/04/2019
|
||||
* TIME : 2:01 PM
|
||||
* Project : BRSPW
|
||||
* Class : StringTypeHandler
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@MappedJdbcTypes(value = {JdbcType.VARCHAR, JdbcType.CHAR})
|
||||
public class StringTypeHandler extends BaseTypeHandler<String> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement preparedStatement, int i, String s, JdbcType jdbcType) throws SQLException {
|
||||
preparedStatement.setString(i, s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, String s) throws SQLException {
|
||||
if (resultSet.getString(s) != null) {
|
||||
return resultSet.getString(s).trim();
|
||||
} else {
|
||||
return resultSet.getString(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(ResultSet resultSet, int i) throws SQLException {
|
||||
if (resultSet.getString(i) != null) {
|
||||
return resultSet.getString(i).trim();
|
||||
} else {
|
||||
return resultSet.getString(i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNullableResult(CallableStatement callableStatement, int i) throws SQLException {
|
||||
if (callableStatement.getString(i) != null) {
|
||||
return callableStatement.getString(i).trim();
|
||||
} else {
|
||||
return callableStatement.getString(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,221 @@
|
||||
package gtpa.brs.home.web;
|
||||
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import gtpa.brs.user.dto.UserInfo;
|
||||
import gtpa.brs.util.PageURIUtil;
|
||||
import gtpa.brs.util.Result;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import eu.bitwalker.useragentutils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* The type Init controller.
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Controller
|
||||
public class InitController {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(InitController.class);
|
||||
@Autowired
|
||||
UserInfo userInfo;
|
||||
|
||||
@Autowired
|
||||
PageURIUtil pageURIUtil;
|
||||
|
||||
/**
|
||||
* Instantiates a new Init controller.
|
||||
*/
|
||||
public InitController() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 다국어 처리 Root Url 처리
|
||||
*
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @param model the model
|
||||
* @return the string
|
||||
* @throws Exception the exception
|
||||
* @date 2017.12.22
|
||||
* @author Inswave
|
||||
* @example websquare 진입 후 세션과 설정 값에 따른 화면 xml 분기를 위한 controller. 고려 대상은 websquare.jsp와 I18N.jsp. 화면 페이지의 정보는 properties파일에서 일괄 관리.
|
||||
* @todo 차후 interceptor에서 일괄 처리 가능한지 체크 해야 함.
|
||||
*/
|
||||
@RequestMapping(value = "/I18N", method = RequestMethod.GET)
|
||||
public String indexMultiLang(HttpServletRequest request, HttpServletResponse response, Model model) {
|
||||
model.addAttribute("movePage", getInitPage(request.getParameter("w2xPath")));
|
||||
return "websquare/I18N";
|
||||
}
|
||||
|
||||
/**
|
||||
* 기본 Root Url 처리
|
||||
*
|
||||
* @param request the request
|
||||
* @param response the response
|
||||
* @return the model and view
|
||||
* @throws Exception the exception
|
||||
* @date 2017.12.22
|
||||
* @author Inswave
|
||||
* @todo url의 경로가 /(root)인 경우 웹스퀘어 엔진에서 하위 컨텐츠 로딩 부분의 특이사항이 발견되어 redirect로 처리.수정 및 개선 필요.
|
||||
*/
|
||||
@RequestMapping(value = "/ws.do", method = RequestMethod.GET)
|
||||
public ModelAndView IndexHideBase(HttpServletRequest request, HttpServletResponse response) {
|
||||
ModelAndView mv = new ModelAndView();
|
||||
HttpSession session = request.getSession(false);
|
||||
|
||||
String movePage = request.getParameter("w2xPath");
|
||||
String linkPage = request.getParameter("link");
|
||||
if (session.getAttribute("w2xPath") != null) {
|
||||
movePage = (String) session.getAttribute("w2xPath");
|
||||
session.removeAttribute("w2xPath");
|
||||
} else {
|
||||
if (movePage == null || movePage.equals("")) {
|
||||
movePage = getInitPage(movePage);
|
||||
}
|
||||
}
|
||||
|
||||
if (linkPage == null && session.getAttribute("link") != null) {
|
||||
linkPage = (String) session.getAttribute("link");
|
||||
session.removeAttribute("link");
|
||||
}
|
||||
|
||||
mv.setViewName("websquare/websquare");
|
||||
mv.addObject("movePage", movePage);
|
||||
mv.addObject("link", linkPage);
|
||||
logger.info("movePage ::" + movePage);
|
||||
logger.info("link ::" + linkPage);
|
||||
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
if (deviceType.getName().indexOf("Computer") > -1) {
|
||||
return mv;
|
||||
} else {
|
||||
String redirectUrl= "/";
|
||||
RedirectView redirectView = new RedirectView(redirectUrl);
|
||||
redirectView.setStatusCode(HttpStatus.MOVED_PERMANENTLY);
|
||||
return new ModelAndView(redirectView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* SPA IFrame에서 호출하는 Blank 페이지를 반환하다.
|
||||
*
|
||||
* @param request the request
|
||||
* @param model the model
|
||||
* @return string
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
@RequestMapping(value = "/blank.xml", method = RequestMethod.GET)
|
||||
public String callBlankPage(HttpServletRequest request, Model model){
|
||||
return "websquare/blank";
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그인 페이지 Url을 반환한다.
|
||||
*
|
||||
* @param w2xPath w2xPath 파라미터
|
||||
* @return 로그인 페이지 Url
|
||||
*/
|
||||
private String getInitPage(String w2xPath) {
|
||||
String movePage = w2xPath;
|
||||
// session이 없을 경우 login 화면으로 이동.
|
||||
if (!userInfo.isLogined()) {
|
||||
// session이 있고 w2xPath가 없을 경우 index화면으로 이동.
|
||||
if (movePage == null) {
|
||||
//movePage = pageURIUtil.getLoginPage();
|
||||
movePage = pageURIUtil.getIndexPage();
|
||||
} else if (w2xPath.indexOf("/cm/main/") < 0) {
|
||||
//movePage = pageURIUtil.getLoginPage();
|
||||
movePage = pageURIUtil.getIndexPage();
|
||||
} else if (w2xPath.indexOf("/cm/join/") < 0) {
|
||||
logger.info(w2xPath);
|
||||
}
|
||||
} else {
|
||||
if (movePage == null) {
|
||||
// DB 설정조회 초기 page 구성
|
||||
movePage = pageURIUtil.getIndexPageURI();
|
||||
|
||||
// DB에 값이 저장되어 있지 않은 경우 기본 index화면으로 이동
|
||||
if (movePage == null) {
|
||||
movePage = pageURIUtil.getIndexPageURI();
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("getInit movePage ::" + movePage);
|
||||
return movePage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init temp data map.
|
||||
*
|
||||
* @param request the request
|
||||
* @return the map
|
||||
*/
|
||||
@RequestMapping(value = "/initTempData.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Map initTempData(HttpServletRequest request) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session != null && session.getAttribute("scopedTarget.tempUserSessionInfoDTO") != null) {
|
||||
session.invalidate();
|
||||
}
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE,re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE,e);
|
||||
}
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/refreshPage.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Map refreshPage(HttpServletRequest request, @RequestBody Map param) {
|
||||
Result result = new Result();
|
||||
try {
|
||||
HttpSession session = request.getSession(false);
|
||||
if (session != null) {
|
||||
session.setAttribute("link", param.get("link"));
|
||||
}
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(Result.STATUS_ERROR, Result.STATUS_ERROR_MESSAGE,re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE,e);
|
||||
}
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/error.do", method = RequestMethod.GET)
|
||||
public String errorPage() {
|
||||
return "error/errorPage";
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package gtpa.brs.interceptor;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import eu.bitwalker.useragentutils.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.servlet.mvc.WebContentInterceptor;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 31/05/2019
|
||||
* TIME : 5:30 PM
|
||||
* Project : BRSMW
|
||||
* Class : AccessStaticInterceptor
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
public class AccessStaticInterceptor extends WebContentInterceptor {
|
||||
private Logger logger = LoggerFactory.getLogger(AccessStaticInterceptor.class);
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
|
||||
logger.info("=== refresh browser");
|
||||
logger.info("=== access Browser:" + request.getHeader("user-agent"));
|
||||
logger.info("- - - - - - - - - - - - - - - - -");
|
||||
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// browser
|
||||
Browser browser = agent.getBrowser();
|
||||
HashMap userBrowser = userBrowserChk(request);
|
||||
if("".equals(userBrowser.get("browser"))) {
|
||||
userBrowser.put("browser",browser.getName());
|
||||
}
|
||||
|
||||
logger.info("Browser type: " + browser.getBrowserType().getName());
|
||||
logger.info("**Browser name: " + userBrowser.get("browser"));
|
||||
logger.info("Browser render engine: " + browser.getRenderingEngine());
|
||||
/*
|
||||
* 21.05.12 - 서주희 : 아이폰에서 카카오톡 웹뷰로 실행하는 경우 오류가 발생하는 걸로 파악되어 try catch 적용
|
||||
* */
|
||||
try{
|
||||
Version version = agent.getBrowserVersion();
|
||||
if ("".equals(userBrowser.get("version"))) {
|
||||
logger.info("*Browser version: " + version.getVersion());
|
||||
logger.info("Browser major version: " + version.getMajorVersion());
|
||||
logger.info("Browser minor version: " + version.getMinorVersion());
|
||||
} else {
|
||||
logger.info("*Browser version: " + userBrowser.get("version"));
|
||||
}
|
||||
}catch(RuntimeException e){
|
||||
logger.info("**Browser version: " + userBrowser.get("version"));
|
||||
}
|
||||
logger.info("Browser manufacturer: " + browser.getManufacturer().getName());
|
||||
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
logger.info("*OS Name: " + os.getName());
|
||||
logger.info("OS Manufacturer: " + os.getManufacturer());
|
||||
OperatingSystem group = os.getGroup();
|
||||
logger.info("*OS group: " + group.getName());
|
||||
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
return super.preHandle(request, response, handler);
|
||||
}
|
||||
|
||||
private HashMap userBrowserChk(HttpServletRequest request) {
|
||||
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
HashMap info = new HashMap();
|
||||
String browser = "";
|
||||
String version = "";
|
||||
try {
|
||||
if(userAgent.indexOf("Trident") > -1 || userAgent.indexOf("MSIE") > -1) { //IE
|
||||
|
||||
if(userAgent.indexOf("Trident/7") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "11";
|
||||
}else if(userAgent.indexOf("Trident/6") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "10";
|
||||
}else if(userAgent.indexOf("Trident/5") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "9";
|
||||
}else if(userAgent.indexOf("Trident/4") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "8";
|
||||
}else if(userAgent.indexOf("edge") > -1 || userAgent.indexOf("Edge") > -1) {
|
||||
browser = "Edge";
|
||||
}
|
||||
|
||||
}else if(userAgent.indexOf("Whale") > -1){ //네이버 WHALE
|
||||
//browser = "WHALE " + userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
browser = "Whale";
|
||||
version = userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("SamsungBrowser") > -1){ //SamsungBrowser
|
||||
//browser = "WHALE " + userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
browser = "SamsungBrowser";
|
||||
version = userAgent.split("SamsungBrowser/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("Opera") > -1 || userAgent.indexOf("OPR") > -1){ //오페라
|
||||
if(userAgent.indexOf("Opera") > -1) {
|
||||
browser = "Opera";
|
||||
version = userAgent.split("Opera/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("OPR") > -1) {
|
||||
browser = "Opera";
|
||||
version = userAgent.split("OPR/")[1].toString().split(" ")[0].toString();
|
||||
}
|
||||
}else if(userAgent.indexOf("Firefox") > -1){ //파이어폭스
|
||||
browser = "Firefox";
|
||||
version = userAgent.split("Firefox/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1 ){ //사파리
|
||||
browser = "Safari";
|
||||
version = userAgent.split("Safari/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("egde") > -1 || userAgent.indexOf("Edge") == -1 || userAgent.indexOf("Edg") == -1){ //사파리
|
||||
browser = "Edge";
|
||||
}else if(userAgent.indexOf("Chrome") > -1){ //크롬
|
||||
browser = "Chrome";
|
||||
version = userAgent.split("Chrome/")[1].toString().split(" ")[0].toString();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("[userBrowserChk Error::",e);
|
||||
}
|
||||
|
||||
|
||||
info.put("browser",browser);
|
||||
info.put("version",version);
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package gtpa.brs.interceptor;
|
||||
|
||||
import gtpa.brs.user.dto.UserInfo;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.mvc.WebContentInterceptor;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 17/04/2019
|
||||
* TIME : 5:59 PM
|
||||
* Project : BRSPW
|
||||
* Class : AuthenticInterceptor
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
public class AuthenticInterceptor extends WebContentInterceptor {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(AuthenticInterceptor.class);
|
||||
|
||||
@Autowired
|
||||
private UserInfo userInfo;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
|
||||
boolean result = true;
|
||||
try {
|
||||
logger.info("== AuthenticInterceptor preHandle start =======" + request.getRequestURI());
|
||||
HandlerMethod handlerMethod = (HandlerMethod) handler;
|
||||
Method method = handlerMethod.getMethod();
|
||||
logger.info("== method ======" + method);
|
||||
logger.info("== bean ======" + handlerMethod.getBean());
|
||||
|
||||
//logger.info("== UserInfo ============================" + userInfo.getUserInfo());
|
||||
if(request.getSession(false) != null){
|
||||
logger.info("== tempUserSessionInfoDTO =====================" + request.getSession(false).getAttribute("scopedTarget.tempUserSessionInfoDTO"));
|
||||
}
|
||||
|
||||
if (userInfo.getUserId() != null) {
|
||||
result = true;
|
||||
} else {
|
||||
result = false;
|
||||
//response.sendRedirect("/error.do");
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
//response.getWriter().write("{\"rsMsg\":{\"message\":\"장시간 서비스 이용이 없어 접속 종료되었습니다.\"}}");
|
||||
response.getWriter().write("{\"rsMsg\":{\"message\":\"접근권한이 없습니다.<br/>중복로그인 또는 장시간 서비스 이용이 없어 접속이 종료되었습니다.\"}}");
|
||||
/*response.setContentType("text/html; charset=UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("<script>alert('접근 권한이 없습니다.'); location.href='https://oksign.seoul.go.kr/pc/';</script>");*/
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::"+ "" + "]",e);
|
||||
}finally {
|
||||
logger.info("== result ============================" + result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
super.postHandle(request, response, handler, modelAndView);
|
||||
logger.info("== AuthenticInterceptor postHandle start =======" + request.getRequestURI());
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,267 @@
|
||||
package gtpa.brs.interceptor;
|
||||
|
||||
import gtpa.brs.login.service.LoginService;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import eu.bitwalker.useragentutils.*;
|
||||
import gtpa.brs.util.Result;
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.After;
|
||||
import org.aspectj.lang.annotation.AfterReturning;
|
||||
import org.aspectj.lang.annotation.AfterThrowing;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.annotation.Before;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressFBWarnings
|
||||
@Aspect // AOP bean : AOP 애노테이션
|
||||
@Component
|
||||
@EnableAspectJAutoProxy
|
||||
public class MessageAdvice {
|
||||
|
||||
@Autowired
|
||||
private LoginService loginService;
|
||||
private Logger logger = LoggerFactory.getLogger(MessageAdvice.class);
|
||||
|
||||
// 매개변수 확인, @Before(대상:호출전)
|
||||
@Before("execution(* gtpa.brs.login.web.LoginController.login(..)) || execution(* gtpa.brs.login.web.LoginController.deUserLogin(..))")
|
||||
public void startLog(JoinPoint jp) {
|
||||
// 핵심업무의 클래스,매서드, 매개변수 로깅
|
||||
//logger.info("핵심업무 코드정보 : "+jp.getSignature());
|
||||
//logger.info("메서드 : "+jp.getSignature().getName());
|
||||
//logger.info("매개변수:"+ Arrays.toString(jp.getArgs()));
|
||||
}
|
||||
|
||||
// method 실행 시간 확인, @Around : 핵심업무 전후에 자동호출, ProceedingJoinPoint
|
||||
@Around("execution(* gtpa.brs.login.web.LoginController.login(..)) || execution(* gtpa.brs.login.web.LoginController.deUserLogin(..))")
|
||||
public Object timeLog(ProceedingJoinPoint pjp) throws Throwable {
|
||||
// 핵심업무 실행 전
|
||||
long start = System.currentTimeMillis();
|
||||
// 핵심업무 실행
|
||||
Object result = pjp.proceed();
|
||||
// 핵심업무 실행 후
|
||||
long end = System.currentTimeMillis();
|
||||
// 핵심업무 실행시간 연산
|
||||
//logger.info("매개변수:"+Arrays.toString(pjp.getArgs()));
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// browser
|
||||
Browser browser = agent.getBrowser();
|
||||
//logger.info("Browser type: " + browser.getBrowserType().getName());
|
||||
//logger.info("*Browser name: " + browser.getName());
|
||||
//logger.info("Browser render engine: " + browser.getRenderingEngine());
|
||||
|
||||
Version version = agent.getBrowserVersion();
|
||||
if (version != null) {
|
||||
//logger.info("Browser version: " + version.getVersion());
|
||||
//logger.info("Browser major version: " + version.getMajorVersion());
|
||||
//logger.info("Browser minor version: " + version.getMinorVersion());
|
||||
}
|
||||
//logger.info("Browser manufacturer: " + browser.getManufacturer().getName());
|
||||
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
//logger.info("*OS Name: " + os.getName());
|
||||
//logger.info("OS Manufacturer: " + os.getManufacturer());
|
||||
OperatingSystem group = os.getGroup();
|
||||
//logger.info("*OS group: " + group.getName());
|
||||
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("SESSION::" + request.getSession().getAttribute("MBER_NO"));
|
||||
HashMap param = new HashMap();
|
||||
param.put("MBER_NO", request.getSession().getAttribute("MBER_NO"));
|
||||
param.put("DEVICE", deviceType.getName());
|
||||
//param.put("BROWSER", browser.getName());
|
||||
HashMap userBrowser = userBrowserChk(request);
|
||||
if("".equals(userBrowser.get("browser"))) {
|
||||
userBrowser.put("browser",browser.getName());
|
||||
}
|
||||
logger.info("**Browser name: " + userBrowser.get("browser"));
|
||||
param.put("BROWSER", userBrowser.get("browser"));
|
||||
//HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
String ip = getRemoteAddr(request);
|
||||
logger.info("logined::" + ip);
|
||||
boolean isLogined = false;
|
||||
boolean isTempMber = false;
|
||||
if (request.getSession().getAttribute("IS_LOGIN") != null) {
|
||||
isLogined = (boolean) request.getSession().getAttribute("IS_LOGIN");
|
||||
if (request.getSession().getAttribute("IS_TEMPMBER") != null) {
|
||||
isTempMber = (boolean) request.getSession().getAttribute("IS_TEMPMBER");
|
||||
}
|
||||
}
|
||||
if (isLogined) {
|
||||
if (isTempMber) {
|
||||
param.put("MBER_NO", request.getSession().getAttribute("MBER_ID"));
|
||||
}
|
||||
loginService.insertConnInfo(param);
|
||||
}
|
||||
logger.info(pjp.getSignature().getName()+"메서드 실행시간:"+(end-start));
|
||||
logger.info("==========================================");
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getRemoteAddr(HttpServletRequest request) {
|
||||
String ip = null;
|
||||
ip = request.getHeader("X-Forwarded-For");
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
if (ip == null || ip.length()== 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("X-Real-IP");
|
||||
}
|
||||
if (ip == null || ip.length()== 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("X-RealIP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("REMOTE_ADDR");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
@AfterReturning(value = "execution(* gtpa.brs.login.web.LoginController.login(..)) || execution(* gtpa.brs.login.web.LoginController.deUserLogin(..))", returning = "returnValue")
|
||||
public void writeErrorLog(JoinPoint joinPoint,Object returnValue) {
|
||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
|
||||
Object[] args = joinPoint.getArgs();
|
||||
LinkedHashMap reqParam = new LinkedHashMap<>();
|
||||
for (Object arg:args) {
|
||||
if(arg instanceof LinkedHashMap){
|
||||
LinkedHashMap obj = (LinkedHashMap)arg;
|
||||
if(obj instanceof LinkedHashMap) {
|
||||
reqParam = (LinkedHashMap) obj.get("dma_loginCheck");
|
||||
}
|
||||
}
|
||||
}
|
||||
logger.info("로그인 요청 ID : "+reqParam.get("id"));
|
||||
if(returnValue instanceof Object){
|
||||
if (returnValue instanceof Map){
|
||||
if(((Map) returnValue).get("rsMsg") != null) {
|
||||
Map rsMsg = (Map)((Map) returnValue).get("rsMsg");
|
||||
if("E".equals(rsMsg.get("statusCode")) || "O".equals(rsMsg.get("statusCode"))){
|
||||
logger.error("핵심업무 코드정보 : "+joinPoint.getSignature());
|
||||
logger.error("메서드 : "+joinPoint.getSignature().getName());
|
||||
logger.error("매개변수 : "+ Arrays.toString(joinPoint.getArgs()));
|
||||
logger.error("에러메세지 : " + rsMsg.get("message"));
|
||||
logger.error("에러코드 : " + rsMsg.get("statusCode"));
|
||||
logger.error("returnValue Error::" + returnValue);
|
||||
logger.error("Client IP Addr::" + getRemoteAddr(request));
|
||||
Map errLogKey = new HashMap();
|
||||
errLogKey.put("REQ_ID",reqParam.get("id"));
|
||||
errLogKey.put("RES_CODE",rsMsg.get("statusCode"));
|
||||
errLogKey.put("RES_MESG",rsMsg.get("message"));
|
||||
loginService.insertPromptErrorConnInfo(errLogKey);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (returnValue instanceof Result){
|
||||
if(((Result) returnValue).getResult().get("rsMsg") != null){
|
||||
Map rsMsg = (Map) ((Result) returnValue).getResult().get("rsMsg");
|
||||
if("E".equals(rsMsg.get("statusCode")) || "O".equals(rsMsg.get("statusCode"))){
|
||||
logger.error("핵심업무 코드정보 : "+joinPoint.getSignature());
|
||||
logger.error("메서드 : "+joinPoint.getSignature().getName());
|
||||
logger.error("매개변수 : "+ Arrays.toString(joinPoint.getArgs()));
|
||||
logger.error("에러메세지 : " + rsMsg.get("message"));
|
||||
logger.error("에러코드 : " + rsMsg.get("statusCode"));
|
||||
logger.error("returnValue Error::" + returnValue);
|
||||
logger.error("Client IP Addr::" + getRemoteAddr(request));
|
||||
Map errLogKey = new HashMap();
|
||||
errLogKey.put("REQ_ID",reqParam.get("id"));
|
||||
errLogKey.put("RES_CODE",rsMsg.get("statusCode"));
|
||||
errLogKey.put("RES_MESG",rsMsg.get("message"));
|
||||
loginService.insertPromptErrorConnInfo(errLogKey);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HashMap userBrowserChk(HttpServletRequest request) {
|
||||
|
||||
String userAgent = request.getHeader("user-agent");
|
||||
HashMap info = new HashMap();
|
||||
String browser = "";
|
||||
String version = "";
|
||||
try {
|
||||
if(userAgent.indexOf("Trident") > -1 || userAgent.indexOf("MSIE") > -1) { //IE
|
||||
|
||||
if(userAgent.indexOf("Trident/7") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "11";
|
||||
}else if(userAgent.indexOf("Trident/6") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "10";
|
||||
}else if(userAgent.indexOf("Trident/5") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "9";
|
||||
}else if(userAgent.indexOf("Trident/4") > -1) {
|
||||
browser = "Internet Explorer";
|
||||
version = "8";
|
||||
}else if(userAgent.indexOf("edge") > -1 || userAgent.indexOf("Edge") > -1) {
|
||||
browser = "Edge";
|
||||
}
|
||||
|
||||
}else if(userAgent.indexOf("Whale") > -1){ //네이버 WHALE
|
||||
//browser = "WHALE " + userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
browser = "Whale";
|
||||
version = userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("SamsungBrowser") > -1){ //SamsungBrowser
|
||||
//browser = "WHALE " + userAgent.split("Whale/")[1].toString().split(" ")[0].toString();
|
||||
browser = "SamsungBrowser";
|
||||
version = userAgent.split("SamsungBrowser/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("Opera") > -1 || userAgent.indexOf("OPR") > -1){ //오페라
|
||||
if(userAgent.indexOf("Opera") > -1) {
|
||||
browser = "Opera";
|
||||
version = userAgent.split("Opera/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("OPR") > -1) {
|
||||
browser = "Opera";
|
||||
version = userAgent.split("OPR/")[1].toString().split(" ")[0].toString();
|
||||
}
|
||||
}else if(userAgent.indexOf("Firefox") > -1){ //파이어폭스
|
||||
browser = "Firefox";
|
||||
version = userAgent.split("Firefox/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") == -1 ){ //사파리
|
||||
browser = "Safari";
|
||||
version = userAgent.split("Safari/")[1].toString().split(" ")[0].toString();
|
||||
}else if(userAgent.indexOf("egde") > -1 || userAgent.indexOf("Edge") == -1 || userAgent.indexOf("Edg") == -1){ //사파리
|
||||
browser = "Edge";
|
||||
}else if(userAgent.indexOf("Chrome") > -1){ //크롬
|
||||
browser = "Chrome";
|
||||
version = userAgent.split("Chrome/")[1].toString().split(" ")[0].toString();
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
logger.error("[userBrowserChk Error::",e);
|
||||
}
|
||||
|
||||
|
||||
info.put("browser",browser);
|
||||
info.put("version",version);
|
||||
|
||||
return info;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package gtpa.brs.interceptor;
|
||||
|
||||
import gtpa.brs.user.dto.UserInfo;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 11/04/2019
|
||||
* TIME : 2:57 PM
|
||||
* Project : BRSPW
|
||||
* Class : SessionCheckInterceptor
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
public class SessionCheckInterceptor extends HandlerInterceptorAdapter {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(SessionCheckInterceptor.class);
|
||||
|
||||
@Autowired
|
||||
private UserInfo userInfo;
|
||||
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
String loginInfo;
|
||||
HttpSession session = request.getSession();
|
||||
String reqUrl = request.getRequestURI();
|
||||
String w2xPath = request.getParameter("w2xPath");
|
||||
String link = request.getParameter("link");
|
||||
logger.info("== sessionId ============================" + session.getId());
|
||||
logger.info("== preHandle start ============================" + reqUrl);
|
||||
logger.info("== w2xPath ============================" + w2xPath);
|
||||
logger.info("== link ============================" + link);
|
||||
//logger.info("== userInfo =====================" + userInfo.getUserInfo());
|
||||
|
||||
boolean result = true;
|
||||
try {
|
||||
loginInfo = (String) session.getAttribute("MBER_ID");
|
||||
logger.info("== loginInfo =====================" + loginInfo);
|
||||
if (loginInfo != null) {
|
||||
userInfo.setUserInfo(session);
|
||||
} else {
|
||||
if (!isSkipURI(request)) {
|
||||
if ((w2xPath != null) || (reqUrl.indexOf(".xml") > -1)) {
|
||||
// 웹스퀘어 화면 호출 시 세션이 종료된 경우, 로그인 페이지로 Redirect 처리한다.
|
||||
result = false;
|
||||
//response.sendRedirect("/ws.do?w2xPath=/cm/main/sub.xml&link=/cm/main/auth_check.xml");
|
||||
session.setAttribute("w2xPath", "/cm/main/auth_check.xml");
|
||||
response.sendRedirect("/");
|
||||
} else {
|
||||
// 서비스 호출 시 세션이 종료된 경우, Session 종료 Alert 후, 로그인 페이지로 Redirect 처리 한다.
|
||||
result = false;
|
||||
response.setContentType("application/json");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().write("{\"rsMsg\":{\"statusCode\":\"E\", \"errorCode\" : \"E0001\", \"message\":\"접근권한이 없습니다.<br/>중복로그인 또는 장시간 서비스 이용이 없어 접속이 종료되었습니다.\",\"status\":\"Error\"}}");
|
||||
/*response.getWriter().write("{\"statusCode\":\"E\", \"errorCode\" : \"E0001\", \"message\":\"Session이 종료 되었습니다.\",\"status\":\"Error\"}");*/
|
||||
}
|
||||
}
|
||||
|
||||
if (link != null) {
|
||||
if (link.indexOf("/ui") > -1) {
|
||||
result = false;
|
||||
//response.sendRedirect("/ws.do?w2xPath=/cm/main/sub.xml&link=/cm/main/auth_check.xml");
|
||||
session.setAttribute("w2xPath", "/cm/main/auth_check.xml");
|
||||
response.sendRedirect("/");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
} finally {
|
||||
logger.info("== result ============================" + result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Session 체크 대상에서 예외 URI 구성
|
||||
*
|
||||
* @param request 파라미터 정보
|
||||
* @date 2016. 8. 29.
|
||||
* @returns <boolean> 반환 변수 및 객체
|
||||
* @author InswaveSystems
|
||||
* @example 샘플 코드
|
||||
*/
|
||||
private boolean isSkipURI(HttpServletRequest request) {
|
||||
|
||||
String[] skipUrl = {"/", "/I18N", "/ws.do"};
|
||||
String[] skipw2xPath = {"/cm", "/pub"};
|
||||
boolean result = false;
|
||||
String uri = (request.getRequestURI()).replace(request.getContextPath(), "");
|
||||
String w2xPath = request.getParameter("w2xPath");
|
||||
|
||||
for (int i = 0; i < skipUrl.length; i++) {
|
||||
if (uri.equals(skipUrl[i])) {
|
||||
result = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (w2xPath != null) {
|
||||
for (int i = 0; i < skipw2xPath.length; i++) {
|
||||
if (w2xPath.contains(skipw2xPath[i])) {
|
||||
if (!result) result = true;
|
||||
break;
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,943 @@
|
||||
package gtpa.brs.join.service;
|
||||
|
||||
import gtpa.brs.security.CACHECK;
|
||||
import gtpa.brs.util.Result;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import eu.bitwalker.useragentutils.*;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.BasicResponseHandler;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 18/04/2019
|
||||
* TIME : 10:56 AM
|
||||
* Project : BRSPW
|
||||
* Class : CACheckService
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Service
|
||||
public class CACheckService {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(CACheckService.class);
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
Properties env;
|
||||
|
||||
/*@Autowired
|
||||
HttpClient httpClient;*/
|
||||
|
||||
/**
|
||||
* Is exsist comp map.
|
||||
*
|
||||
* @param compRegNum the comp reg num
|
||||
* @param corpRegNum the corp reg num
|
||||
* @param compNm the comp nm
|
||||
* @param compRepNm the comp rep nm
|
||||
* @return the map
|
||||
*/
|
||||
public Map<String, Object> isExsistComp(String compRegNum, String corpRegNum, String compNm, String compRepNm) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
CACHECK caComp = new CACHECK();
|
||||
int iReturn = -1;
|
||||
|
||||
iReturn = caComp.fnRequest(env.getProperty("Globals.Nice.CACheck.Code"), env.getProperty("Globals.Nice.CACheck.Key"), "3", compRegNum, corpRegNum, compNm, compRepNm);
|
||||
|
||||
if (iReturn == 0) {
|
||||
logger.info("RETURN_CODE=" + caComp.getReturnCode()); // 인증결과코드
|
||||
logger.info("STATUS_CODE=" + caComp.getStatusCode()); // 기업상태코드
|
||||
logger.info("RETURN_COMPNAME=" + caComp.getReturnCompName()); // 응답 기업명
|
||||
logger.info("RETURN_REPNAME=" + caComp.getReturnRepName()); // 응답 대표자명
|
||||
result.put("RETURN_CODE", caComp.getReturnCode());
|
||||
result.put("STATUS_CODE", caComp.getStatusCode());
|
||||
result.put("RETURN_MSG", getRtnMessage(caComp.getReturnCode()));
|
||||
result.put("STATUS_MSG", getStatusMessage(caComp.getStatusCode()));
|
||||
result.put("RETURN_COMPNAME", caComp.getReturnCompName());
|
||||
result.put("RETURN_REPNAME", caComp.getReturnRepName());
|
||||
} else {
|
||||
logger.info("AUTH_ERROR=" + iReturn);
|
||||
}
|
||||
result.put("iReturn", iReturn);
|
||||
result.put("iReturn_MSG", getIReturnMessage(iReturn));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interop service map.
|
||||
*
|
||||
* @param niNo the ni no
|
||||
* @return the map
|
||||
*/
|
||||
public Map<String, Object> interopService(String niNo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
String url = env.getProperty("Globals.SmartPlatform.Url") + env.getProperty("Globals.SmartPlatform.getCiInfo");
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String sysId = env.getProperty("Globals.SmartPlatfom.SysId");
|
||||
String uniqueID = UUID.randomUUID().toString();
|
||||
|
||||
Map reqData = new LinkedHashMap();
|
||||
reqData.put("sysId", sysId);
|
||||
reqData.put("transId", uniqueID);
|
||||
reqData.put("tranDate", now);
|
||||
reqData.put("juminNo", niNo);
|
||||
|
||||
logger.info("reqData::" + reqData);
|
||||
result = requestCI(url, reqData);
|
||||
logger.info("result::" + result);
|
||||
|
||||
result.put("CI", result.get("sci"));
|
||||
if (result.get("rspnsResult").equals("S")) {
|
||||
result.put("iRtnCI", 1);
|
||||
result.put("iRtnCI_MSG", result.get("rspnsMssage"));
|
||||
} else {
|
||||
result.put("iRtnCI", -9);
|
||||
result.put("iRtnCI_MSG", "차량소유자 정보조회 오류가 발생하였습니다.");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map requestCI(String requestURL,
|
||||
Map reqData
|
||||
) {
|
||||
Map result = new HashMap();
|
||||
//CloseableHttpClient client = HttpClients.createDefault();
|
||||
RequestConfig defaultRequestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(10000)
|
||||
.setConnectTimeout(10000)
|
||||
.setConnectionRequestTimeout(10000)
|
||||
.setStaleConnectionCheckEnabled(true)
|
||||
.build();
|
||||
CloseableHttpClient client = HttpClients.custom()
|
||||
.setDefaultRequestConfig(defaultRequestConfig)
|
||||
.build();
|
||||
try {
|
||||
String token = env.getProperty("Globals.SmartPlatform.token");
|
||||
HttpPost postRequest = new HttpPost(requestURL); //POST 메소드 URL 새성
|
||||
postRequest.setHeader("Accept", "application/json");
|
||||
postRequest.setHeader("BROKER_TOKEN", token);
|
||||
List<NameValuePair> pairs = new ArrayList<>();
|
||||
Iterator<String> keys = reqData.keySet().iterator();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
pairs.add(new BasicNameValuePair(key, (String) reqData.get(key)));
|
||||
}
|
||||
postRequest.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8"));
|
||||
HttpResponse response = client.execute(postRequest);
|
||||
//Response 출력
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
ResponseHandler<String> handler = new BasicResponseHandler();
|
||||
String body = handler.handleResponse(response);
|
||||
JSONParser parser = new JSONParser();
|
||||
Object obj = parser.parse(body);
|
||||
JSONObject jsonObj = (JSONObject) obj;
|
||||
JSONObject data = (JSONObject) jsonObj.get("data");
|
||||
logger.info("body::" + jsonObj.toJSONString());
|
||||
if (jsonObj.get("result").equals("SUCCESS")) {
|
||||
if (jsonObj.get("resultCode").equals("0000")) {
|
||||
result.put("rspnsResult", "S");
|
||||
result.put("sci", data.get("sci"));
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
}
|
||||
result.put("rspnsCode", data.get("rspnsCode"));
|
||||
result.put("rspnsMssage", data.get("rspnsMssage"));
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", jsonObj.get("resultMessage"));
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.error("response is error : " + response.getStatusLine().getStatusCode());
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "response is error");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "시스템 오류가 발생하였습니다.");
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "연결 오류가 발생하였습니다.");
|
||||
} finally {
|
||||
try {
|
||||
client.close();
|
||||
} catch (IOException io) {
|
||||
logger.error("[process error::" + "io.getMessage()" + "]", io);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check plus main result.
|
||||
*
|
||||
* @param request the request
|
||||
* @param type the type
|
||||
* @return the result
|
||||
*/
|
||||
public Result checkPlusMain(HttpServletRequest request, String type) {
|
||||
Result result = new Result();
|
||||
HttpSession session = request.getSession();
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
String uri = request.getRequestURI();
|
||||
String contextPath = request.getContextPath();
|
||||
String host = "";
|
||||
if (uri.equals("/")) {
|
||||
host = url.toString();
|
||||
} else {
|
||||
host = url.substring(0, url.indexOf(uri)) + contextPath + "/";
|
||||
}
|
||||
//String url = env.getProperty("Globals.Url");
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
String sAuthType = type; // 없으면 기본 선택화면, M: 핸드폰, C: 신용카드, X: 공인인증서
|
||||
String sReturnUrl; // 성공시 이동될 URL
|
||||
String sErrorUrl; // 실패시 이동될 URL
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
sReturnUrl = host + "check/credit/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "check/credit/fail.do"; // 실패시 이동될 URL
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
sReturnUrl = host + "check/phone/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "check/phone/fail.do"; // 실패시 이동될 URL
|
||||
}
|
||||
String sRequestNumber = "REQ0000000001"; // 요청 번호, 이는 성공/실패후에 같은 값으로 되돌려주게 되므로
|
||||
// 업체에서 적절하게 변경하여 쓰거나, 아래와 같이 생성한다.
|
||||
sRequestNumber = niceCheck.getRequestNO(sSiteCode);
|
||||
session.setAttribute("REQ_SEQ", sRequestNumber);
|
||||
|
||||
String popgubun = "N"; //Y : 취소버튼 있음 / N : 취소버튼 없음
|
||||
String customize = ""; //없으면 기본 웹페이지 / Mobile : 모바일페이지
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
if (deviceType.getName() != null && deviceType.getName().indexOf("Computer") > -1) {
|
||||
customize = "";
|
||||
} else {
|
||||
customize = "Mobile";
|
||||
}
|
||||
String sGender = ""; //없으면 기본 선택 값, 0 : 여자, 1 : 남자
|
||||
// CheckPlus(본인인증) 처리 후, 결과 데이타를 리턴 받기위해 다음예제와 같이 http부터 입력합니다.
|
||||
//리턴url은 인증 전 인증페이지를 호출하기 전 url과 동일해야 합니다. ex) 인증 전 url : http://www.~ 리턴 url : http://www.~
|
||||
//String sReturnUrl = "http://www.test.co.kr/checkplus_success.jsp"; // 성공시 이동될 URL
|
||||
//String sErrorUrl = "http://www.test.co.kr/checkplus_fail.jsp"; // 실패시 이동될 URL
|
||||
|
||||
// 입력될 plain 데이타를 만든다.
|
||||
String sPlainData = "7:REQ_SEQ" + sRequestNumber.getBytes().length + ":" + sRequestNumber +
|
||||
"8:SITECODE" + sSiteCode.getBytes().length + ":" + sSiteCode +
|
||||
"9:AUTH_TYPE" + sAuthType.getBytes().length + ":" + sAuthType +
|
||||
"7:RTN_URL" + sReturnUrl.getBytes().length + ":" + sReturnUrl +
|
||||
"7:ERR_URL" + sErrorUrl.getBytes().length + ":" + sErrorUrl +
|
||||
"11:POPUP_GUBUN" + popgubun.getBytes().length + ":" + popgubun +
|
||||
"9:CUSTOMIZE" + customize.getBytes().length + ":" + customize +
|
||||
"6:GENDER" + sGender.getBytes().length + ":" + sGender;
|
||||
|
||||
String sMessage = "";
|
||||
String sEncData = "";
|
||||
|
||||
int iReturn = niceCheck.fnEncode(sSiteCode, sSitePassword, sPlainData);
|
||||
if (iReturn == 0) {
|
||||
sEncData = niceCheck.getCipherData();
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "암호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -2) {
|
||||
sMessage = "암호화 처리오류입니다.";
|
||||
} else if (iReturn == -3) {
|
||||
sMessage = "암호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
if (iReturn != 0) {
|
||||
result.setMsg(result.STATUS_ERROR, sMessage);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
}
|
||||
result.setData("sEncData", sEncData);
|
||||
result.setData("sMessage", sMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* ID/PWD 핸드폰/카드 인증용
|
||||
* Check plus main result.
|
||||
*
|
||||
* @param request the request
|
||||
* @param type the type
|
||||
* @return the result
|
||||
*/
|
||||
public Result idPwdCheckPlusMain(HttpServletRequest request, String type) {
|
||||
Result result = new Result();
|
||||
HttpSession session = request.getSession();
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
String uri = request.getRequestURI();
|
||||
String contextPath = request.getContextPath();
|
||||
String host = "";
|
||||
if (uri.equals("/")) {
|
||||
host = url.toString();
|
||||
} else {
|
||||
host = url.substring(0, url.indexOf(uri)) + contextPath + "/";
|
||||
}
|
||||
//String url = env.getProperty("Globals.Url");
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
String sAuthType = type; // 없으면 기본 선택화면, M: 핸드폰, C: 신용카드, X: 공인인증서
|
||||
String sReturnUrl; // 성공시 이동될 URL
|
||||
String sErrorUrl; // 실패시 이동될 URL
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
sReturnUrl = host + "idSearch/check/credit/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "idSearch/check/credit/fail.do"; // 실패시 이동될 URL
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
sReturnUrl = host + "idSearch/check/phone/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "idSearch/check/phone/fail.do"; // 실패시 이동될 URL
|
||||
}
|
||||
String sRequestNumber = "REQ0000000001"; // 요청 번호, 이는 성공/실패후에 같은 값으로 되돌려주게 되므로
|
||||
// 업체에서 적절하게 변경하여 쓰거나, 아래와 같이 생성한다.
|
||||
sRequestNumber = niceCheck.getRequestNO(sSiteCode);
|
||||
session.setAttribute("REQ_SEQ", sRequestNumber);
|
||||
|
||||
String popgubun = "N"; //Y : 취소버튼 있음 / N : 취소버튼 없음
|
||||
String customize = ""; //없으면 기본 웹페이지 / Mobile : 모바일페이지
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
if (deviceType.getName() != null && deviceType.getName().indexOf("Computer") > -1) {
|
||||
customize = "";
|
||||
} else {
|
||||
customize = "Mobile";
|
||||
}
|
||||
String sGender = ""; //없으면 기본 선택 값, 0 : 여자, 1 : 남자
|
||||
// CheckPlus(본인인증) 처리 후, 결과 데이타를 리턴 받기위해 다음예제와 같이 http부터 입력합니다.
|
||||
//리턴url은 인증 전 인증페이지를 호출하기 전 url과 동일해야 합니다. ex) 인증 전 url : http://www.~ 리턴 url : http://www.~
|
||||
//String sReturnUrl = "http://www.test.co.kr/checkplus_success.jsp"; // 성공시 이동될 URL
|
||||
//String sErrorUrl = "http://www.test.co.kr/checkplus_fail.jsp"; // 실패시 이동될 URL
|
||||
|
||||
// 입력될 plain 데이타를 만든다.
|
||||
String sPlainData = "7:REQ_SEQ" + sRequestNumber.getBytes().length + ":" + sRequestNumber +
|
||||
"8:SITECODE" + sSiteCode.getBytes().length + ":" + sSiteCode +
|
||||
"9:AUTH_TYPE" + sAuthType.getBytes().length + ":" + sAuthType +
|
||||
"7:RTN_URL" + sReturnUrl.getBytes().length + ":" + sReturnUrl +
|
||||
"7:ERR_URL" + sErrorUrl.getBytes().length + ":" + sErrorUrl +
|
||||
"11:POPUP_GUBUN" + popgubun.getBytes().length + ":" + popgubun +
|
||||
"9:CUSTOMIZE" + customize.getBytes().length + ":" + customize +
|
||||
"6:GENDER" + sGender.getBytes().length + ":" + sGender;
|
||||
|
||||
String sMessage = "";
|
||||
String sEncData = "";
|
||||
|
||||
int iReturn = niceCheck.fnEncode(sSiteCode, sSitePassword, sPlainData);
|
||||
if (iReturn == 0) {
|
||||
sEncData = niceCheck.getCipherData();
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "암호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -2) {
|
||||
sMessage = "암호화 처리오류입니다.";
|
||||
} else if (iReturn == -3) {
|
||||
sMessage = "암호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
if (iReturn != 0) {
|
||||
result.setMsg(result.STATUS_ERROR, sMessage);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
}
|
||||
result.setData("sEncData", sEncData);
|
||||
result.setData("sMessage", sMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 카드 추가 등록을 위한 인증용
|
||||
* Check plus main result.
|
||||
*
|
||||
* @param request the request
|
||||
* @param type the type
|
||||
* @return the result
|
||||
*/
|
||||
public Result cardCheckPlusMain(HttpServletRequest request, String type) {
|
||||
Result result = new Result();
|
||||
HttpSession session = request.getSession();
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
String uri = request.getRequestURI();
|
||||
String contextPath = request.getContextPath();
|
||||
String host = "";
|
||||
if (uri.equals("/")) {
|
||||
host = url.toString();
|
||||
} else {
|
||||
host = url.substring(0, url.indexOf(uri)) + contextPath + "/";
|
||||
}
|
||||
//String url = env.getProperty("Globals.Url");
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
String sAuthType = type; // 없으면 기본 선택화면, M: 핸드폰, C: 신용카드, X: 공인인증서
|
||||
String sReturnUrl; // 성공시 이동될 URL
|
||||
String sErrorUrl; // 실패시 이동될 URL
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
sReturnUrl = host + "card/check/credit/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "card/check/credit/fail.do"; // 실패시 이동될 URL
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
sReturnUrl = host + "card/check/phone/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "card/check/phone/fail.do"; // 실패시 이동될 URL
|
||||
}
|
||||
String sRequestNumber = "REQ0000000001"; // 요청 번호, 이는 성공/실패후에 같은 값으로 되돌려주게 되므로
|
||||
// 업체에서 적절하게 변경하여 쓰거나, 아래와 같이 생성한다.
|
||||
sRequestNumber = niceCheck.getRequestNO(sSiteCode);
|
||||
session.setAttribute("REQ_SEQ", sRequestNumber);
|
||||
|
||||
String popgubun = "N"; //Y : 취소버튼 있음 / N : 취소버튼 없음
|
||||
String customize = ""; //없으면 기본 웹페이지 / Mobile : 모바일페이지
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
if (deviceType.getName() != null && deviceType.getName().indexOf("Computer") > -1) {
|
||||
customize = "";
|
||||
} else {
|
||||
customize = "Mobile";
|
||||
}
|
||||
String sGender = ""; //없으면 기본 선택 값, 0 : 여자, 1 : 남자
|
||||
// CheckPlus(본인인증) 처리 후, 결과 데이타를 리턴 받기위해 다음예제와 같이 http부터 입력합니다.
|
||||
//리턴url은 인증 전 인증페이지를 호출하기 전 url과 동일해야 합니다. ex) 인증 전 url : http://www.~ 리턴 url : http://www.~
|
||||
//String sReturnUrl = "http://www.test.co.kr/checkplus_success.jsp"; // 성공시 이동될 URL
|
||||
//String sErrorUrl = "http://www.test.co.kr/checkplus_fail.jsp"; // 실패시 이동될 URL
|
||||
|
||||
// 입력될 plain 데이타를 만든다.
|
||||
String sPlainData = "7:REQ_SEQ" + sRequestNumber.getBytes().length + ":" + sRequestNumber +
|
||||
"8:SITECODE" + sSiteCode.getBytes().length + ":" + sSiteCode +
|
||||
"9:AUTH_TYPE" + sAuthType.getBytes().length + ":" + sAuthType +
|
||||
"7:RTN_URL" + sReturnUrl.getBytes().length + ":" + sReturnUrl +
|
||||
"7:ERR_URL" + sErrorUrl.getBytes().length + ":" + sErrorUrl +
|
||||
"11:POPUP_GUBUN" + popgubun.getBytes().length + ":" + popgubun +
|
||||
"9:CUSTOMIZE" + customize.getBytes().length + ":" + customize +
|
||||
"6:GENDER" + sGender.getBytes().length + ":" + sGender;
|
||||
|
||||
String sMessage = "";
|
||||
String sEncData = "";
|
||||
|
||||
int iReturn = niceCheck.fnEncode(sSiteCode, sSitePassword, sPlainData);
|
||||
if (iReturn == 0) {
|
||||
sEncData = niceCheck.getCipherData();
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "암호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -2) {
|
||||
sMessage = "암호화 처리오류입니다.";
|
||||
} else if (iReturn == -3) {
|
||||
sMessage = "암호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
if (iReturn != 0) {
|
||||
result.setMsg(result.STATUS_ERROR, sMessage);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
}
|
||||
result.setData("sEncData", sEncData);
|
||||
result.setData("sMessage", sMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check plus success map.
|
||||
*
|
||||
* @param request the request
|
||||
* @param type the type
|
||||
* @return the map
|
||||
*/
|
||||
public Map checkPlusSuccess(HttpServletRequest request, String type) {
|
||||
Map result = new HashMap();
|
||||
HttpSession session = request.getSession();
|
||||
//인증 후 결과값이 null로 나오는 부분은 관리담당자에게 문의 바랍니다.
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
String sEncodeData = requestReplace(request.getParameter("EncodeData"), "encodeData");
|
||||
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
}
|
||||
String sCipherTime = ""; // 복호화한 시간
|
||||
String sRequestNumber = ""; // 요청 번호
|
||||
String sResponseNumber = ""; // 인증 고유번호
|
||||
String sAuthType = ""; // 인증 수단
|
||||
String sName = ""; // 성명
|
||||
String sDupInfo = ""; // 중복가입 확인값 (DI_64 byte)
|
||||
String sConnInfo = ""; // 연계정보 확인값 (CI_88 byte)
|
||||
String sBirthDate = ""; // 생년월일(YYYYMMDD)
|
||||
String sGender = ""; // 성별
|
||||
String sNationalInfo = ""; // 내/외국인정보 (개발가이드 참조)
|
||||
String sMobileNo = ""; // 휴대폰번호
|
||||
String sMobileCo = ""; // 통신사
|
||||
String sMessage = "";
|
||||
String sPlainData = "";
|
||||
|
||||
int iReturn = niceCheck.fnDecode(sSiteCode, sSitePassword, sEncodeData);
|
||||
|
||||
if (iReturn == 0) {
|
||||
sPlainData = niceCheck.getPlainData();
|
||||
sCipherTime = niceCheck.getCipherDateTime();
|
||||
|
||||
// 데이타를 추출합니다.
|
||||
HashMap mapresult = niceCheck.fnParse(sPlainData);
|
||||
|
||||
sRequestNumber = (String) mapresult.get("REQ_SEQ");
|
||||
sResponseNumber = (String) mapresult.get("RES_SEQ");
|
||||
sAuthType = (String) mapresult.get("AUTH_TYPE");
|
||||
sName = (String) mapresult.get("NAME");
|
||||
//sName = (String)mapresult.get("UTF8_NAME"); //charset utf8 사용시 주석 해제 후 사용
|
||||
sBirthDate = (String) mapresult.get("BIRTHDATE");
|
||||
sGender = (String) mapresult.get("GENDER");
|
||||
sNationalInfo = (String) mapresult.get("NATIONALINFO");
|
||||
sDupInfo = (String) mapresult.get("DI");
|
||||
sConnInfo = (String) mapresult.get("CI");
|
||||
sMobileNo = (String) mapresult.get("MOBILE_NO");
|
||||
sMobileCo = (String) mapresult.get("MOBILE_CO");
|
||||
|
||||
String session_sRequestNumber = (String) session.getAttribute("REQ_SEQ");
|
||||
if (!sRequestNumber.equals(session_sRequestNumber)) {
|
||||
sMessage = "세션값이 다릅니다. 올바른 경로로 접근하시기 바랍니다.";
|
||||
sResponseNumber = "";
|
||||
sAuthType = "";
|
||||
} else {
|
||||
sMessage = "정상적으로 처리 되었습니다.";
|
||||
}
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "복호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -4) {
|
||||
sMessage = "복호화 처리오류입니다.";
|
||||
} else if (iReturn == -5) {
|
||||
sMessage = "복호화 해쉬 오류입니다.";
|
||||
} else if (iReturn == -6) {
|
||||
sMessage = "복호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else if (iReturn == -12) {
|
||||
sMessage = "사이트 패스워드 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
|
||||
result.put("sRequestNumber", sRequestNumber);
|
||||
result.put("sResponseNumber", sResponseNumber);
|
||||
result.put("sAuthType", sAuthType);
|
||||
result.put("sName", sName);
|
||||
result.put("sBirthDate", sBirthDate);
|
||||
result.put("sGender", sGender);
|
||||
result.put("sNationalInfo", sNationalInfo);
|
||||
result.put("sDupInfo", sDupInfo);
|
||||
result.put("sConnInfo", sConnInfo);
|
||||
result.put("sMobileNo", sMobileNo);
|
||||
result.put("sMobileCo", sMobileCo);
|
||||
result.put("sMessage", sMessage);
|
||||
result.put("iReturn", iReturn);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check plus fail map.
|
||||
*
|
||||
* @param request the request
|
||||
* @param type the type
|
||||
* @return the map
|
||||
*/
|
||||
public Map checkPlusFail(HttpServletRequest request, String type) {
|
||||
Map result = new HashMap();
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
|
||||
String sEncodeData = requestReplace(request.getParameter("EncodeData"), "encodeData");
|
||||
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
}
|
||||
|
||||
String sCipherTime = ""; // 복호화한 시간
|
||||
String sRequestNumber = ""; // 요청 번호
|
||||
String sErrorCode = ""; // 인증 결과코드
|
||||
String sAuthType = ""; // 인증 수단
|
||||
String sMessage = "";
|
||||
String sPlainData = "";
|
||||
|
||||
int iReturn = niceCheck.fnDecode(sSiteCode, sSitePassword, sEncodeData);
|
||||
|
||||
if (iReturn == 0) {
|
||||
sPlainData = niceCheck.getPlainData();
|
||||
sCipherTime = niceCheck.getCipherDateTime();
|
||||
|
||||
// 데이타를 추출합니다.
|
||||
HashMap mapresult = niceCheck.fnParse(sPlainData);
|
||||
|
||||
sRequestNumber = (String) mapresult.get("REQ_SEQ");
|
||||
sErrorCode = (String) mapresult.get("ERR_CODE");
|
||||
sAuthType = (String) mapresult.get("AUTH_TYPE");
|
||||
sMessage = "본인인증에 실패하였습니다. 입력데이터를 확인 바랍니다.";
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "복호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -4) {
|
||||
sMessage = "복호화 처리오류입니다.";
|
||||
} else if (iReturn == -5) {
|
||||
sMessage = "복호화 해쉬 오류입니다.";
|
||||
} else if (iReturn == -6) {
|
||||
sMessage = "복호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else if (iReturn == -12) {
|
||||
sMessage = "사이트 패스워드 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
|
||||
result.put("sRequestNumber", sRequestNumber);
|
||||
result.put("sCipherTime", sCipherTime);
|
||||
result.put("sAuthType", sAuthType);
|
||||
result.put("sErrorCode", sErrorCode);
|
||||
result.put("sMessage", sMessage);
|
||||
result.put("iReturn", iReturn);
|
||||
return result;
|
||||
}
|
||||
|
||||
private String getIReturnMessage(int iReturn) {
|
||||
String rtnMsg = "";
|
||||
switch (iReturn) {
|
||||
case 0:
|
||||
rtnMsg = "정상 처리";
|
||||
break;
|
||||
case -1:
|
||||
rtnMsg = "암호화 시스템 오류";
|
||||
break;
|
||||
case -2:
|
||||
rtnMsg = "암호화 처리 오류";
|
||||
break;
|
||||
case -3:
|
||||
rtnMsg = "암호화 데이터에 오류";
|
||||
break;
|
||||
case -4:
|
||||
rtnMsg = "복호화 처리 오류";
|
||||
break;
|
||||
case -5:
|
||||
rtnMsg = "복호화 데이터 검증 실패";
|
||||
break;
|
||||
case -6:
|
||||
rtnMsg = "복호화 데이터에 오류";
|
||||
break;
|
||||
case -7:
|
||||
rtnMsg = "암호화 버전 불일치";
|
||||
break;
|
||||
case -8:
|
||||
rtnMsg = "암호화 버전 불일치";
|
||||
break;
|
||||
case -9:
|
||||
rtnMsg = "입력값 오류";
|
||||
break;
|
||||
case -12:
|
||||
rtnMsg = "사이트코드/패스워드 불일치";
|
||||
break;
|
||||
case -18:
|
||||
rtnMsg = "Request 데이터 오류/통신 오류 (방화벽 확인 필요)";
|
||||
break;
|
||||
}
|
||||
return rtnMsg;
|
||||
|
||||
}
|
||||
|
||||
private String getRtnMessage(String rtnCode) {
|
||||
String rtnMsg = "";
|
||||
switch (rtnCode) {
|
||||
case "01":
|
||||
rtnMsg = "일치";
|
||||
break;
|
||||
case "02":
|
||||
rtnMsg = "기업명불일치";
|
||||
break;
|
||||
case "03":
|
||||
rtnMsg = "기업명미보유";
|
||||
break;
|
||||
case "04":
|
||||
rtnMsg = "시스템오류";
|
||||
break;
|
||||
case "05":
|
||||
rtnMsg = "사업자/법인번호 유효성 오류";
|
||||
break;
|
||||
case "08":
|
||||
rtnMsg = "서비스이용 권한 없음";
|
||||
break;
|
||||
case "09":
|
||||
rtnMsg = "필수입력값오류";
|
||||
break;
|
||||
case "12":
|
||||
rtnMsg = "대표자 불일치";
|
||||
break;
|
||||
case "13":
|
||||
rtnMsg = "대표자 미보유";
|
||||
break;
|
||||
case "22":
|
||||
rtnMsg = "사업자/법인명일치 + 대표자 불일치";
|
||||
break;
|
||||
case "23":
|
||||
rtnMsg = "사업자/법인명일치 + 대표자 미보유";
|
||||
break;
|
||||
}
|
||||
return rtnMsg;
|
||||
}
|
||||
|
||||
private String getStatusMessage(String statusCode) {
|
||||
String rtnMsg = "";
|
||||
switch (statusCode) {
|
||||
case "0":
|
||||
rtnMsg = "정보없음";
|
||||
break;
|
||||
case "1":
|
||||
rtnMsg = "정상";
|
||||
break;
|
||||
case "6":
|
||||
rtnMsg = "부도";
|
||||
break;
|
||||
case "7":
|
||||
rtnMsg = "휴업";
|
||||
break;
|
||||
case "8":
|
||||
rtnMsg = "폐업";
|
||||
break;
|
||||
case "9":
|
||||
rtnMsg = "폐업";
|
||||
break;
|
||||
}
|
||||
|
||||
return rtnMsg;
|
||||
}
|
||||
|
||||
private String requestReplace(String paramValue, String gubun) {
|
||||
|
||||
String result = "";
|
||||
|
||||
if (paramValue != null) {
|
||||
|
||||
paramValue = paramValue.replaceAll("<", "<").replaceAll(">", ">");
|
||||
|
||||
paramValue = paramValue.replaceAll("\\*", "");
|
||||
paramValue = paramValue.replaceAll("\\?", "");
|
||||
paramValue = paramValue.replaceAll("\\[", "");
|
||||
paramValue = paramValue.replaceAll("\\{", "");
|
||||
paramValue = paramValue.replaceAll("\\(", "");
|
||||
paramValue = paramValue.replaceAll("\\)", "");
|
||||
paramValue = paramValue.replaceAll("\\^", "");
|
||||
paramValue = paramValue.replaceAll("\\$", "");
|
||||
paramValue = paramValue.replaceAll("'", "");
|
||||
paramValue = paramValue.replaceAll("@", "");
|
||||
paramValue = paramValue.replaceAll("%", "");
|
||||
paramValue = paramValue.replaceAll(";", "");
|
||||
paramValue = paramValue.replaceAll(":", "");
|
||||
paramValue = paramValue.replaceAll("-", "");
|
||||
paramValue = paramValue.replaceAll("#", "");
|
||||
paramValue = paramValue.replaceAll("--", "");
|
||||
paramValue = paramValue.replaceAll("-", "");
|
||||
paramValue = paramValue.replaceAll(",", "");
|
||||
|
||||
if (gubun != "encodeData") {
|
||||
paramValue = paramValue.replaceAll("\\+", "");
|
||||
paramValue = paramValue.replaceAll("/", "");
|
||||
paramValue = paramValue.replaceAll("=", "");
|
||||
}
|
||||
|
||||
result = paramValue;
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Result deLoginCheckPlusMain(HttpServletRequest request, String type) {
|
||||
Result result = new Result();
|
||||
HttpSession session = request.getSession();
|
||||
NiceID.Check.CPClient niceCheck = new NiceID.Check.CPClient();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
String uri = request.getRequestURI();
|
||||
String contextPath = request.getContextPath();
|
||||
String host = "";
|
||||
if (uri.equals("/")) {
|
||||
host = url.toString();
|
||||
} else {
|
||||
host = url.substring(0, url.indexOf(uri)) + contextPath + "/";
|
||||
}
|
||||
//String url = env.getProperty("Globals.Url");
|
||||
String sSiteCode; // NICE로부터 부여받은 사이트 코드
|
||||
String sSitePassword; // NICE로부터 부여받은 사이트 패스워드
|
||||
String sAuthType = type; // 없으면 기본 선택화면, M: 핸드폰, C: 신용카드, X: 공인인증서
|
||||
String sReturnUrl; // 성공시 이동될 URL
|
||||
String sErrorUrl; // 실패시 이동될 URL
|
||||
if (type.equals("C")) {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Credit.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Credit.Key");
|
||||
sReturnUrl = host + "login/credit/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "login/credit/fail.do"; // 실패시 이동될 URL
|
||||
} else {
|
||||
sSiteCode = env.getProperty("Globals.Nice.NiceID.Phone.Code");
|
||||
sSitePassword = env.getProperty("Globals.Nice.NiceID.Phone.Key");
|
||||
sReturnUrl = host + "login/phone/success.do"; // 성공시 이동될 URL
|
||||
sErrorUrl = host + "login/phone/fail.do"; // 실패시 이동될 URL
|
||||
}
|
||||
String sRequestNumber = "REQ0000000001"; // 요청 번호, 이는 성공/실패후에 같은 값으로 되돌려주게 되므로
|
||||
// 업체에서 적절하게 변경하여 쓰거나, 아래와 같이 생성한다.
|
||||
sRequestNumber = niceCheck.getRequestNO(sSiteCode);
|
||||
session.setAttribute("REQ_SEQ", sRequestNumber);
|
||||
|
||||
String popgubun = "N"; //Y : 취소버튼 있음 / N : 취소버튼 없음
|
||||
String customize = ""; //없으면 기본 웹페이지 / Mobile : 모바일페이지
|
||||
UserAgent agent = UserAgent.parseUserAgentString(request.getHeader("user-agent"));
|
||||
// operating system
|
||||
OperatingSystem os = agent.getOperatingSystem();
|
||||
// device type
|
||||
DeviceType deviceType = os.getDeviceType();
|
||||
logger.info("*Device: " + deviceType.getName());
|
||||
if (deviceType.getName() != null && deviceType.getName().indexOf("Computer") > -1) {
|
||||
customize = "";
|
||||
} else {
|
||||
customize = "Mobile";
|
||||
}
|
||||
String sGender = ""; //없으면 기본 선택 값, 0 : 여자, 1 : 남자
|
||||
// CheckPlus(본인인증) 처리 후, 결과 데이타를 리턴 받기위해 다음예제와 같이 http부터 입력합니다.
|
||||
//리턴url은 인증 전 인증페이지를 호출하기 전 url과 동일해야 합니다. ex) 인증 전 url : http://www.~ 리턴 url : http://www.~
|
||||
//String sReturnUrl = "http://www.test.co.kr/checkplus_success.jsp"; // 성공시 이동될 URL
|
||||
//String sErrorUrl = "http://www.test.co.kr/checkplus_fail.jsp"; // 실패시 이동될 URL
|
||||
|
||||
// 입력될 plain 데이타를 만든다.
|
||||
String sPlainData = "7:REQ_SEQ" + sRequestNumber.getBytes().length + ":" + sRequestNumber +
|
||||
"8:SITECODE" + sSiteCode.getBytes().length + ":" + sSiteCode +
|
||||
"9:AUTH_TYPE" + sAuthType.getBytes().length + ":" + sAuthType +
|
||||
"7:RTN_URL" + sReturnUrl.getBytes().length + ":" + sReturnUrl +
|
||||
"7:ERR_URL" + sErrorUrl.getBytes().length + ":" + sErrorUrl +
|
||||
"11:POPUP_GUBUN" + popgubun.getBytes().length + ":" + popgubun +
|
||||
"9:CUSTOMIZE" + customize.getBytes().length + ":" + customize +
|
||||
"6:GENDER" + sGender.getBytes().length + ":" + sGender;
|
||||
|
||||
String sMessage = "";
|
||||
String sEncData = "";
|
||||
|
||||
int iReturn = niceCheck.fnEncode(sSiteCode, sSitePassword, sPlainData);
|
||||
if (iReturn == 0) {
|
||||
sEncData = niceCheck.getCipherData();
|
||||
} else if (iReturn == -1) {
|
||||
sMessage = "암호화 시스템 에러입니다.";
|
||||
} else if (iReturn == -2) {
|
||||
sMessage = "암호화 처리오류입니다.";
|
||||
} else if (iReturn == -3) {
|
||||
sMessage = "암호화 데이터 오류입니다.";
|
||||
} else if (iReturn == -9) {
|
||||
sMessage = "입력 데이터 오류입니다.";
|
||||
} else {
|
||||
sMessage = "알수 없는 에러 입니다. iReturn : " + iReturn;
|
||||
}
|
||||
if (iReturn != 0) {
|
||||
result.setMsg(result.STATUS_ERROR, sMessage);
|
||||
} else {
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
}
|
||||
result.setData("sEncData", sEncData);
|
||||
result.setData("sMessage", sMessage);
|
||||
return result;
|
||||
}
|
||||
|
||||
//티머니비즈페이
|
||||
public Result tbCheckMain(HttpServletRequest request, String sMember) {
|
||||
Result result = new Result();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
String uri = request.getRequestURI();
|
||||
String contextPath = request.getContextPath();
|
||||
String host = "";
|
||||
if (uri.equals("/")) {
|
||||
host = url.toString();
|
||||
} else {
|
||||
host = url.substring(0, url.indexOf(uri)) + contextPath + "/";
|
||||
}
|
||||
|
||||
String tbUrl = env.getProperty("Globals.tb.Url"); //티머니비즈페이 요청 URL
|
||||
String frcInflCd;
|
||||
String sReturnUrl; // 성공시 이동될 URL
|
||||
sReturnUrl = host + "check/tb/success.do"; // 성공시 이동될 URL
|
||||
frcInflCd = env.getProperty("Globals.tb.frcInflCd.pc");
|
||||
|
||||
// 입력될 tData 데이타를 만든다.
|
||||
String tData = "{"
|
||||
+ "\"frcId\":\"" + env.getProperty("Globals.tb.frcId") + "\","
|
||||
+ "\"frcCusId\":\"" + sMember + "\","
|
||||
+ "\"frcInflCd\":\"" + frcInflCd + "\","
|
||||
+ "\"frcAddInfo\":{\"stcmpNo\":\"BRSPG0000001\",\"setleMnMno\":\"BRSPG0000001010\",\"setleMnKnd\":\"004\",\"ccmpCode\":\"TMN\",\"ccmpKnd\":\"TB\"},"
|
||||
+ "\"sbrdFrcId\":\"" + "" + "\","
|
||||
+ "\"authAmt\":\"" + "0" + "\","
|
||||
+ "\"callbackUrl\":\"TMBPAY,callbackTmbpay\","
|
||||
+ "\"returnUrl\":\"" + sReturnUrl + "\""
|
||||
+ "}";
|
||||
result.setData("tbUrl", tbUrl);
|
||||
result.setData("tData", tData);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
package gtpa.brs.join.service;
|
||||
|
||||
import gtpa.brs.user.dto.TempUserSessionInfoDTO;
|
||||
import gtpa.brs.util.Result;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 19/04/2019
|
||||
* TIME : 2:06 PM
|
||||
* Project : BRSPW
|
||||
* Class : JoinService
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public interface JoinService {
|
||||
|
||||
/**
|
||||
* Is id exsist int.
|
||||
*
|
||||
* @param id the id
|
||||
* @return the int
|
||||
*/
|
||||
int isIdExsist(String id);
|
||||
|
||||
|
||||
/**
|
||||
* Is member exsist map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
Map isMemberExsist(Map param);
|
||||
|
||||
/**
|
||||
* Insert member info result.
|
||||
*
|
||||
* @param tempUserSessionInfoDTO the temp user session info dto
|
||||
* @return the result
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
Result insertMemberInfo(TempUserSessionInfoDTO tempUserSessionInfoDTO) throws SQLException;
|
||||
|
||||
/**
|
||||
* Gets stplat info.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the stplat info
|
||||
*/
|
||||
List<Map> getStplatInfo(Map param);
|
||||
|
||||
/**
|
||||
* Gets credit code.
|
||||
*
|
||||
* @return the credit code
|
||||
*/
|
||||
List<Map> getCreditCode();
|
||||
|
||||
/**
|
||||
* Gets bank code.
|
||||
*
|
||||
* @return the bank code
|
||||
*/
|
||||
List<Map> getBankCode();
|
||||
|
||||
/**
|
||||
* Is exsist vhcle owner int.
|
||||
*
|
||||
* @param car the car
|
||||
* @return the int
|
||||
*/
|
||||
int isExsistVhcleOwner(Map<String, Object> car);
|
||||
|
||||
/**
|
||||
* Insert join failer log.
|
||||
*
|
||||
* @param param the param
|
||||
*/
|
||||
void insertJoinFailerLog(Map param);
|
||||
|
||||
/**
|
||||
* Gets rdcxpt info all chldrn.
|
||||
*
|
||||
* @param myInfo the my info
|
||||
* @return the rdcxpt info all chldrn
|
||||
*/
|
||||
Map getRdcxptInfoAllChldrn(Map myInfo);
|
||||
|
||||
/**
|
||||
* Gets rdcxpt info ntttn.
|
||||
*
|
||||
* @param myInfo the my info
|
||||
* @return the rdcxpt info ntttn
|
||||
*/
|
||||
Map getRdcxptInfoNtttn(Map myInfo);
|
||||
|
||||
Map getResideInsttCnfirm(Map myInfo);
|
||||
|
||||
|
||||
int vhcleChk(Map params);
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import gtpa.brs.user.dto.TempCarInfo;
|
||||
import gtpa.brs.user.dto.TempUserSessionInfoDTO;
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository("joinDao")
|
||||
public class JoinMapper extends EgovAbstractMapper {
|
||||
|
||||
private String NAMESPACE = "JoinDAO";
|
||||
|
||||
public int insertMemberInfo(TempUserSessionInfoDTO tempUserSessionInfoDTO) {
|
||||
return update(NAMESPACE + ".insertMemberInfo", tempUserSessionInfoDTO);
|
||||
}
|
||||
|
||||
public int insertCarInfos(List carInfos) {
|
||||
int rsltCnt = 0;
|
||||
rsltCnt += insert(NAMESPACE + ".insertCarInfos", carInfos);
|
||||
rsltCnt += insert(NAMESPACE + ".insertCarInfosHistory", carInfos);
|
||||
return rsltCnt;
|
||||
}
|
||||
|
||||
public int insertStplatAgre(TempUserSessionInfoDTO tempUserSessionInfoDTO) {
|
||||
return insert(NAMESPACE + ".insertStplatAgre", tempUserSessionInfoDTO);
|
||||
}
|
||||
|
||||
public int isIdExsist(String id) {
|
||||
return selectOne(NAMESPACE + ".isIdExsist", id);
|
||||
}
|
||||
|
||||
public Map isMemberExsist(Map param) {
|
||||
return selectOne(NAMESPACE + ".isMemberExsist", param);
|
||||
}
|
||||
|
||||
public List<Map> getStplatInfo(Map param) {
|
||||
return selectList(NAMESPACE + ".getStplatInfo", param);
|
||||
}
|
||||
|
||||
public String getTranSerialNo() {
|
||||
return selectOne(NAMESPACE + ".getTranSerialNo");
|
||||
}
|
||||
|
||||
public List<Map> getCreditCode() {
|
||||
return selectList(NAMESPACE + ".getCreditCode");
|
||||
}
|
||||
|
||||
public List<Map> getBankCode() {
|
||||
return selectList(NAMESPACE + ".getBankCode");
|
||||
}
|
||||
|
||||
public int isExsistVhcleOwner(Map<String, Object> car) {
|
||||
return selectOne(NAMESPACE + ".isExsistVhcleOwner", car);
|
||||
}
|
||||
|
||||
public void insertJoinFailerLog(Map param) {
|
||||
insert(NAMESPACE + ".insertJoinFailerLog", param);
|
||||
}
|
||||
|
||||
public int insertMnychRdcxptInfo(TempUserSessionInfoDTO tempUserSessionInfoDTO) {
|
||||
return update(NAMESPACE + ".insertMnychRdcxptInfo", tempUserSessionInfoDTO);
|
||||
}
|
||||
|
||||
public int insertNationMrtrsInfo(TempUserSessionInfoDTO tempUserSessionInfoDTO) {
|
||||
return update(NAMESPACE + ".insertNationMrtrsInfo", tempUserSessionInfoDTO);
|
||||
}
|
||||
|
||||
public int insertSetleAgreAt(TempUserSessionInfoDTO tempUserSessionInfoDTO) {
|
||||
return insert(NAMESPACE + ".insertSetleAgreAt", tempUserSessionInfoDTO);
|
||||
}
|
||||
|
||||
public int vhcleChk(Map param) {
|
||||
return selectOne(NAMESPACE + ".vhcleChk", param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,681 @@
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import gtpa.brs.join.service.JoinService;
|
||||
import gtpa.brs.join.service.impl.JoinMapper;
|
||||
import gtpa.brs.payment.service.PreRegistPaymentService;
|
||||
import gtpa.brs.user.dto.TempUserSessionInfoDTO;
|
||||
import gtpa.brs.util.Result;
|
||||
import gtpa.brs.join.service.impl.PublicFacilityReqXml;
|
||||
import gtpa.brs.join.service.impl.PublicFacilitySend;
|
||||
import gtpa.brs.join.service.impl.NewGpkiUtil;
|
||||
import gtpa.brs.join.service.impl.ShareGpki;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.BasicResponseHandler;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 19/04/2019
|
||||
* TIME : 2:06 PM
|
||||
* Project : BRSPW
|
||||
* Class : JoinServiceImpl
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Service("JoinService")
|
||||
public class JoinServiceImpl implements JoinService {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(JoinServiceImpl.class);
|
||||
|
||||
@Resource(name = "joinDao")
|
||||
JoinMapper joinMapper;
|
||||
|
||||
@Autowired
|
||||
PreRegistPaymentService preRegistPaymentService;
|
||||
|
||||
@Autowired
|
||||
private PublicFacilityReqXml publicFacilityReqXml;
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
Properties env;
|
||||
|
||||
//GPKI사용여부
|
||||
private final boolean useGPKI = true;
|
||||
|
||||
private boolean isRealIp = true;
|
||||
|
||||
@Override
|
||||
public int isIdExsist(String id) {
|
||||
return joinMapper.isIdExsist(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map isMemberExsist(Map param) {
|
||||
return joinMapper.isMemberExsist(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.REQUIRED) //이메소드를 트랜잭션처리
|
||||
public Result insertMemberInfo(TempUserSessionInfoDTO tempUserSessionInfoDTO) throws SQLException {
|
||||
Result result = new Result();
|
||||
try {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("cars", tempUserSessionInfoDTO.getTempCarInfos());
|
||||
params.put("banks", tempUserSessionInfoDTO.getTempBankInfos());
|
||||
params.put("credits", tempUserSessionInfoDTO.getTempCreditInfos());
|
||||
params.put("mberCi", tempUserSessionInfoDTO.getMberCi());
|
||||
params.put("mberNo", tempUserSessionInfoDTO.getMberNo());
|
||||
Map tempUserInfo = (Map) tempUserSessionInfoDTO.getTempUserInfo();
|
||||
params.put("mberMobileNo", tempUserInfo.get("sMobileNo"));
|
||||
params.put("mberMobileCo", tempUserInfo.get("sMobileCo"));
|
||||
if (tempUserSessionInfoDTO.getTempBankInfos() != null && tempUserSessionInfoDTO.getTempBankInfos().size() > 0) {
|
||||
int rsltA = preRegistPaymentService.insertAcctInfoComplete(tempUserSessionInfoDTO.getTempBankInfos());
|
||||
if ((rsltA / 2) != tempUserSessionInfoDTO.getTempBankInfos().size()) {
|
||||
logger.error("계좌등록 INSERT 오류");
|
||||
result.setMsg("Q", "계좌등록 저장중 오류가 발생하였습니다.");
|
||||
result.setData("errorContent","계좌등록 INSERT 오류");
|
||||
return result;
|
||||
//throw new SQLException("계좌등록 저장 오류발생");
|
||||
}
|
||||
}
|
||||
List<Map> dataResponse = preRegistPaymentService.completePayment(params);
|
||||
if (tempUserSessionInfoDTO.getTempCreditInfos().size() != dataResponse.size()) {
|
||||
logger.error("사전결제등록 오류");
|
||||
result.setData("errorContent","사전결제등록 오류");
|
||||
result.setMsg("Q", "카드정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("사전결제등록 오류발생");
|
||||
}
|
||||
int rsltM = joinMapper.insertMemberInfo(tempUserSessionInfoDTO);
|
||||
if (rsltM < 1) {
|
||||
logger.error("회원정보 INSERT 오류");
|
||||
result.setData("errorContent","회원정보 INSERT 오류");
|
||||
result.setMsg("Q", "회원정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("회원정보 저장 오류발생");
|
||||
}
|
||||
int rsltS = joinMapper.insertStplatAgre(tempUserSessionInfoDTO);
|
||||
if (rsltS < 1) {
|
||||
logger.error("회원동의정보 INSERT 오류");
|
||||
result.setData("errorContent","회원동의정보 INSERT 오류");
|
||||
result.setMsg("Q", "회원동의정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("회원동의정보 저장 오류발생");
|
||||
}
|
||||
int rsltSAT = joinMapper.insertSetleAgreAt(tempUserSessionInfoDTO);
|
||||
if (rsltSAT < 1) {
|
||||
logger.error("회원결제동의정보 INSERT 오류");
|
||||
result.setData("errorContent","회원결제동의정보 INSERT 오류");
|
||||
result.setMsg("Q", "회원결제동의정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("회원결제동의정보 저장 오류발생");
|
||||
}
|
||||
if ("Y".equals(tempUserSessionInfoDTO.getMnychRdcxptAt())) {
|
||||
int rsltMny = joinMapper.insertMnychRdcxptInfo(tempUserSessionInfoDTO);
|
||||
if (rsltMny < 1) {
|
||||
logger.error("다자녀정보 INSERT 오류");
|
||||
result.setData("errorContent","다자녀정보 INSERT 오류");
|
||||
result.setMsg("Q", "다자녀정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("다자녀정보 저장 오류발생");
|
||||
}
|
||||
}
|
||||
if ("Y".equals(tempUserSessionInfoDTO.getAthzerAt())) {
|
||||
int rsltNM = joinMapper.insertNationMrtrsInfo(tempUserSessionInfoDTO);
|
||||
if (rsltNM < 1) {
|
||||
logger.error("국가유공자 INSERT 오류");
|
||||
result.setData("errorContent","국가유공자 INSERT 오류");
|
||||
result.setMsg("Q", "국가유공자 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("국가유공자 저장 오류발생");
|
||||
}
|
||||
}
|
||||
List carInfoList = tempUserSessionInfoDTO.getTempCarInfos();
|
||||
int rsltV = joinMapper.insertCarInfos(carInfoList);
|
||||
if ((rsltV / 2) != carInfoList.size()) {
|
||||
logger.error("차량정보 INSERT 오류");
|
||||
result.setData("errorContent","차량정보 INSERT 오류");
|
||||
result.setMsg("Q", "차량정보 저장중 오류가 발생하였습니다.");
|
||||
return result;
|
||||
//throw new SQLException("차량정보 저장 오류발생");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
result.setData("errorContent","입력값 처리도중 오류가 발생하였습니다.");
|
||||
result.setMsg("R", "입력값 처리도중 오류가 발생하였습니다.",re);
|
||||
return result;
|
||||
}
|
||||
result.setMsg(Result.STATUS_SUCESS, "회원가입이 완료되었습니다.");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getStplatInfo(Map param) {
|
||||
return joinMapper.getStplatInfo(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getCreditCode() {
|
||||
return joinMapper.getCreditCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getBankCode() {
|
||||
return joinMapper.getBankCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isExsistVhcleOwner(Map<String, Object> car) {
|
||||
return joinMapper.isExsistVhcleOwner(car);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertJoinFailerLog(Map param) {
|
||||
joinMapper.insertJoinFailerLog(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getResideInsttCnfirm(Map myInfo) {
|
||||
Map result = new HashMap<>();
|
||||
// String url = env.getProperty("Globals.fis.Url") + env.getProperty("Globals.Fis.resideInsttCnfirm");
|
||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String sysId = "11-004";
|
||||
String mberSeNo = (String) myInfo.get("mberSeNo");
|
||||
String mberNm = (String) myInfo.get("searchNm");
|
||||
String uniqueID = UUID.randomUUID().toString();
|
||||
/*
|
||||
* sysId 시스템 ID (6)
|
||||
tranDate 전송일시 (14)
|
||||
transId 트랜잭션ID(요청 원문 식별 값) (40)
|
||||
orgCode 기관코드 (10)
|
||||
id 주민등록번호 (13)
|
||||
name 이름 (38)
|
||||
* */
|
||||
Map<String, Object> reqData = new HashMap<>();
|
||||
reqData.put("sysId", sysId);
|
||||
reqData.put("transId", uniqueID);
|
||||
reqData.put("tranDate", now);
|
||||
reqData.put("orgCode", "");
|
||||
reqData.put("taxPyerIhidNum", mberSeNo);
|
||||
reqData.put("taxPyerNm", mberNm);
|
||||
|
||||
// logger.info("거주지 url::" + url);
|
||||
logger.info("거주지 reqData::" + reqData);
|
||||
result = requestResideInsttCnfirm(reqData);
|
||||
logger.info("거주지 result::" + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRdcxptInfoAllChldrn(Map myInfo) {
|
||||
Map result;
|
||||
String url = env.getProperty("Globals.SmartPlatform.Url") + env.getProperty("Globals.SmartPlatform.rdcxptInfo");
|
||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String sysId = "11-004";
|
||||
String mberSeNo = (String) myInfo.get("mberSeNo");
|
||||
String mberNm = (String) myInfo.get("searchNm");
|
||||
String uniqueID = UUID.randomUUID().toString();
|
||||
/*
|
||||
* sysId 시스템 ID (6)
|
||||
tranDate 전송일시 (14)
|
||||
transId 트랜잭션ID(요청 원문 식별 값) (40)
|
||||
orgCode 기관코드 (10)
|
||||
id 주민등록번호 (13)
|
||||
name 이름 (38)
|
||||
* */
|
||||
Map reqData = new LinkedHashMap();
|
||||
reqData.put("sysId", sysId);
|
||||
reqData.put("transId", uniqueID);
|
||||
reqData.put("tranDate", now);
|
||||
reqData.put("orgCode", "");
|
||||
reqData.put("id", mberSeNo);
|
||||
reqData.put("name", mberNm);
|
||||
|
||||
logger.info("다자녀 url::" + url);
|
||||
logger.info("reqData::" + reqData);
|
||||
result = requestRdcxptInfoAllChldrn(url, reqData);
|
||||
logger.info("result::" + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map getRdcxptInfoNtttn(Map myInfo) {
|
||||
Map result;
|
||||
String url = env.getProperty("Globals.SmartPlatform.Url") + env.getProperty("Globals.SmartPlatform.rdcxptInfoNtttn");
|
||||
String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
String sysId = "11-004";
|
||||
String mberSeNo = (String) myInfo.get("mberSeNo");
|
||||
String uniqueID = UUID.randomUUID().toString();
|
||||
|
||||
Map reqData = new LinkedHashMap();
|
||||
reqData.put("sysId", sysId);
|
||||
reqData.put("transId", uniqueID);
|
||||
reqData.put("tranDate", now);
|
||||
reqData.put("juminNo", mberSeNo);
|
||||
|
||||
logger.info("reqData::" + reqData);
|
||||
result = requestRdcxptInfoNtttn(url, reqData);
|
||||
logger.info("result::" + result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> requestResideInsttCnfirm(Map<String, Object> facMap) {
|
||||
Result result = new Result();
|
||||
HashMap<String, Object> rtnMap = new LinkedHashMap<String, Object>();
|
||||
HashMap<String, Object> respMap = new LinkedHashMap<String, Object>();
|
||||
HashMap<String, Object> facCntcMap = new HashMap<>();
|
||||
final String strOrgCode = "1174000001" ; //기관코드(고정)
|
||||
String strSysId = (String) facMap.get("sysId");
|
||||
facCntcMap.put("orgCode", strOrgCode);
|
||||
facCntcMap.put("id", facMap.get("taxPyerIhidNum"));
|
||||
facCntcMap.put("name", facMap.get("taxPyerNm"));
|
||||
facCntcMap.put("sysId", facMap.get("sysId"));
|
||||
logger.info("[거주자] facCntcMap::"+facCntcMap.toString());
|
||||
|
||||
HashMap<String, Object> reqBodyXmlMap = new HashMap<>();
|
||||
reqBodyXmlMap = publicFacilityReqXml.getResideInsttCnfirmXml(facCntcMap);
|
||||
logger.info("[거주자] reqBodyXmlMap::"+reqBodyXmlMap.toString());
|
||||
String strReqXml = (String)reqBodyXmlMap.get("reqXml"); //전송할 XML메세지
|
||||
String strReqBodyMessage = (String)reqBodyXmlMap.get("reqBodyMessage");//전송할 본문XML메세지
|
||||
String strXmlNs = (String)reqBodyXmlMap.get("xmlNs");//xmlNs이름
|
||||
String strElementResp = (String)reqBodyXmlMap.get("elementResp");//xml Element Response명
|
||||
|
||||
NewGpkiUtil g = null;
|
||||
String serviceUrl = env.getProperty("Globals.Public.ResideInsttCnfirmService.Url");
|
||||
if (useGPKI) {
|
||||
String encoded = null;
|
||||
String strReqSendXml = null;
|
||||
try {
|
||||
logger.info("[거주자] 여기도 탔나::");
|
||||
final String targetServerId = "SVR1311000030";
|
||||
g = ShareGpki.getGpkiUtil(targetServerId, strSysId, isRealIp);
|
||||
logger.info("[거주자] 여기도 탔나2::");
|
||||
String charset = "UTF-8";
|
||||
//String original = strReqXml.split("<getAllChldrnCoCnfirm xmlns=\"http://ccais.mopas.go.kr/dh/jmn/services/jumin/AllChldrnCoCnfirm/types\">")[1].split("</getAllChldrnCoCnfirm>")[0];
|
||||
// String encoded;
|
||||
byte[] encrypted = g.encrypt(strReqBodyMessage.getBytes(charset), targetServerId);
|
||||
byte[] signed = g.sign(encrypted);
|
||||
encoded = g.encode(signed);
|
||||
logger.info("[거주지] strReqXml : " + strReqXml);
|
||||
|
||||
strReqSendXml = strReqXml;
|
||||
{
|
||||
strReqSendXml = strReqSendXml.replace(strReqBodyMessage, encoded);
|
||||
}
|
||||
logger.info("[거주지] strReqSendXml : " + strReqSendXml);
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
}
|
||||
|
||||
String strRespMsg = PublicFacilitySend.doService(serviceUrl, strReqSendXml);
|
||||
logger.info("[거주지] strRespMsg : " + strRespMsg);
|
||||
|
||||
if (strRespMsg.indexOf("Fault>") > 0){ //오류발생시
|
||||
respMap.put("transId", (String)facMap.get("transId"));
|
||||
|
||||
rtnMap.put("result", "fail");
|
||||
rtnMap.put("resultCode", "9999");
|
||||
rtnMap.put("resultMessage", result.STATUS_ERROR_MESSAGE + "[거주지]");
|
||||
rtnMap.put("data", respMap);
|
||||
|
||||
facMap.put("cntcResult", "FAIL");
|
||||
facMap.put("cntcResultCode", "9999");
|
||||
facMap.put("cntcMessage", strRespMsg + "[거주지]");
|
||||
logger.info("[거주지] facMap : " + facMap);
|
||||
logger.info("[거주지] rtnMap : " + rtnMap);
|
||||
// apicntcInfoProcess.cntcCarInfoAdd(facMap);//연계정보 저장
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
String responseEncData = strRespMsg.split("<" + strElementResp + " xmlns=\"" +strXmlNs+ "\">")[1]
|
||||
.split("</"+ strElementResp +">")[0];
|
||||
|
||||
//logger.info("responseEncData : " + responseEncData);
|
||||
|
||||
String decrypted = "";
|
||||
{
|
||||
byte[] decoded;
|
||||
try {
|
||||
decoded = g.decode(responseEncData);
|
||||
byte[] validated = g.validate(decoded);
|
||||
decrypted = new String(g.decrypt(validated), "UTF-8");
|
||||
decrypted = decrypted.replace("><", ">\n<");
|
||||
} catch (RuntimeException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
String dcriptMsg = strRespMsg.replace(responseEncData, decrypted);
|
||||
logger.info("[거주지] dcriptMsg : " + dcriptMsg);
|
||||
|
||||
if (dcriptMsg.indexOf("Fault>") <= 0){ //정상발생시
|
||||
InputSource is = new InputSource(new StringReader(dcriptMsg));
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);
|
||||
// 파싱할 tag
|
||||
NodeList nList = document.getElementsByTagName("getResideInsttCnfirmResponse");
|
||||
|
||||
for(int i = 0; i < nList.getLength(); i++){
|
||||
Node nNode = nList.item(i);
|
||||
if(nNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
Element eElement = (Element) nNode;
|
||||
logger.info("[거주지] 주민등록번호 : " + PublicFacilityReqXml.getTagValue("id", eElement));
|
||||
logger.info("[거주지] 이름 : " + PublicFacilityReqXml.getTagValue("name", eElement));
|
||||
logger.info("[거주지] 행정동코드 : " + PublicFacilityReqXml.getTagValue("hangkikCd", eElement));
|
||||
logger.info("[거주지] 확인결과 : " + PublicFacilityReqXml.getTagValue("serviceResult", eElement)); //1:성공, 2:주민등록번호오류, 3:성명오류, 4:거주자아님, 9:시스템오류, 99:등록된이용기관이아님
|
||||
logger.info("[거주지] 기관코드 : " + PublicFacilityReqXml.getTagValue("orgCode", eElement));
|
||||
respMap.put("transId", (String)facMap.get("transId"));
|
||||
respMap.put("id", PublicFacilityReqXml.getTagValue("id", eElement));
|
||||
respMap.put("name", PublicFacilityReqXml.getTagValue("name", eElement));
|
||||
respMap.put("hangkikCd", PublicFacilityReqXml.getTagValue("hangkikCd", eElement));
|
||||
respMap.put("serviceResult", PublicFacilityReqXml.getTagValue("serviceResult", eElement));
|
||||
respMap.put("orgCode", PublicFacilityReqXml.getTagValue("orgCode", eElement));
|
||||
}
|
||||
}
|
||||
respMap.put("transId", (String)facMap.get("transId"));
|
||||
|
||||
rtnMap.put("result", "SUCCESS");
|
||||
rtnMap.put("resultCode", "0000");
|
||||
rtnMap.put("resultMessage", result.STATUS_SUCESS_MESSAGE + "[거주지]");
|
||||
rtnMap.put("data", respMap);
|
||||
|
||||
facMap.put("cntcResult", "SUCCESS");
|
||||
facMap.put("cntcResultCode", "0000");
|
||||
facMap.put("cntcMessage", result.STATUS_SUCESS_MESSAGE + "[거주지]");
|
||||
facMap.put("id", respMap.get("id"));
|
||||
facMap.put("name", respMap.get("name"));
|
||||
facMap.put("hangkikCd", respMap.get("hangkikCd"));
|
||||
facMap.put("serviceResult", respMap.get("serviceResult"));
|
||||
facMap.put("orgCode", respMap.get("orgCode"));
|
||||
logger.info("[거주지] rtnMap : " + rtnMap);
|
||||
// apicntcInfoProcess.cntcDspsnAdd(facMap);//연계정보 저장
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
// TODO Auto-generated catch block
|
||||
respMap.put("transId", (String)facMap.get("transId"));
|
||||
|
||||
rtnMap.put("result", "FAIL");
|
||||
rtnMap.put("resultCode", "9999");
|
||||
rtnMap.put("resultMessage", result.STATUS_ERROR_MESSAGE + "[거주지]");
|
||||
rtnMap.put("data", respMap);
|
||||
|
||||
logger.info("[거주지] rtnMap : " + rtnMap);
|
||||
// apicntcInfoProcess.cntcDspsnAdd(facMap);//연계정보 저장
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
respMap.put("transId", (String)facMap.get("transId"));
|
||||
|
||||
rtnMap.put("result", "FAIL");
|
||||
rtnMap.put("resultCode", "9999");
|
||||
rtnMap.put("resultMessage", result.STATUS_ERROR_MESSAGE + "[거주지]");
|
||||
rtnMap.put("data", respMap);
|
||||
|
||||
logger.info("[거주지] rtnMap : " + rtnMap);
|
||||
// apicntcInfoProcess.cntcDspsnAdd(facMap);//연계정보 저장
|
||||
}
|
||||
}
|
||||
|
||||
} /**else{
|
||||
//String strRespMsg = PublicFacilitySend.doService(serviceUrl, strReqXml);
|
||||
String strRespMsg = PublicFacilityReqXml.getTestRespResideInsttCnfirmXml();
|
||||
logger.info("[거주지] strRespMsg : " + strRespMsg);
|
||||
InputSource is = new InputSource(new StringReader(strRespMsg));
|
||||
Document document = null;
|
||||
try {
|
||||
document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(is);
|
||||
} catch (SAXException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
} catch (ParserConfigurationException e) {
|
||||
// TODO Auto-generated catch block
|
||||
logger.info("에러발생");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 파싱할 tag
|
||||
NodeList nList = document.getElementsByTagName("getResideInsttCnfirmResponse");
|
||||
//System.out.println("파싱할 리스트 수 : "+ nList.getLength());
|
||||
|
||||
for(int i = 0; i < nList.getLength(); i++){
|
||||
Node nNode = nList.item(i);
|
||||
if(nNode.getNodeType() == Node.ELEMENT_NODE){
|
||||
|
||||
Element eElement = (Element) nNode;
|
||||
//System.out.println(eElement.getTextContent());
|
||||
logger.info("기관코드 : " + PublicFacilityReqXml.getTagValue("orgCode", eElement));
|
||||
logger.info("주민등록번호 : " + PublicFacilityReqXml.getTagValue("id", eElement));
|
||||
logger.info("이름 : " + PublicFacilityReqXml.getTagValue("name", eElement));
|
||||
logger.info("행정동코드 : " + PublicFacilityReqXml.getTagValue("hangkikCd", eElement));
|
||||
logger.info("거주행정기관확인결과 : " + PublicFacilityReqXml.getTagValue("serviceResult", eElement));
|
||||
|
||||
rtnMap.put("transId", (String)facMap.get("transId"));
|
||||
rtnMap.put("orgCode", PublicFacilityReqXml.getTagValue("orgCode", eElement));
|
||||
rtnMap.put("id", PublicFacilityReqXml.getTagValue("id", eElement));
|
||||
rtnMap.put("name", PublicFacilityReqXml.getTagValue("name", eElement));
|
||||
rtnMap.put("hangkikCd", PublicFacilityReqXml.getTagValue("hangkikCd", eElement));
|
||||
rtnMap.put("serviceResult", PublicFacilityReqXml.getTagValue("serviceResult", eElement));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return rtnMap;
|
||||
}
|
||||
|
||||
public Map requestRdcxptInfoAllChldrn(String requestURL, Map reqData) {
|
||||
Map result = new HashMap();
|
||||
// CloseableHttpClient client = HttpClients.createDefault();
|
||||
RequestConfig defaultRequestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000)
|
||||
.setConnectionRequestTimeout(10000).setStaleConnectionCheckEnabled(true).build();
|
||||
CloseableHttpClient client = HttpClients.custom().setDefaultRequestConfig(defaultRequestConfig).build();
|
||||
try {
|
||||
String token = env.getProperty("Globals.SmartPlatform.token");
|
||||
HttpPost postRequest = new HttpPost(requestURL); // POST 메소드 URL 새성
|
||||
postRequest.setHeader("Accept", "application/json");
|
||||
postRequest.setHeader("BROKER_TOKEN", token);
|
||||
List<NameValuePair> pairs = new ArrayList<>();
|
||||
Iterator<String> keys = reqData.keySet().iterator();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
pairs.add(new BasicNameValuePair(key, (String) reqData.get(key)));
|
||||
}
|
||||
postRequest.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8"));
|
||||
HttpResponse response = client.execute(postRequest);
|
||||
// Response 출력
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
ResponseHandler<String> handler = new BasicResponseHandler();
|
||||
String body = handler.handleResponse(response);
|
||||
JSONParser parser = new JSONParser();
|
||||
Object obj = parser.parse(body);
|
||||
JSONObject jsonObj = (JSONObject) obj;
|
||||
JSONObject data = (JSONObject) jsonObj.get("data");
|
||||
logger.info("body::" + jsonObj.toJSONString());
|
||||
if (jsonObj.get("result").equals("SUCCESS")) {
|
||||
if (jsonObj.get("resultCode").equals("0000")) {
|
||||
result.put("rspnsResult", "S");
|
||||
result.put("data", data);
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
}
|
||||
result.put("rspnsCode", jsonObj.get("resultCode"));
|
||||
result.put("rspnsMssage", jsonObj.get("resultMessage"));
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", jsonObj.get("resultMessage"));
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.error("response is error : " + response.getStatusLine().getStatusCode());
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "response is error");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "시스템 오류가 발생하였습니다.");
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "연결 오류가 발생하였습니다.");
|
||||
} finally {
|
||||
try {
|
||||
client.close();
|
||||
} catch (IOException io) {
|
||||
logger.error("[process error::" + "" + "]", io);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map requestRdcxptInfoNtttn(String requestURL,
|
||||
Map reqData
|
||||
) {
|
||||
Map result = new HashMap();
|
||||
//CloseableHttpClient client = HttpClients.createDefault();
|
||||
RequestConfig defaultRequestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(10000)
|
||||
.setConnectTimeout(10000)
|
||||
.setConnectionRequestTimeout(10000)
|
||||
.setStaleConnectionCheckEnabled(true)
|
||||
.build();
|
||||
CloseableHttpClient client = HttpClients.custom()
|
||||
.setDefaultRequestConfig(defaultRequestConfig)
|
||||
.build();
|
||||
try {
|
||||
String token = env.getProperty("Globals.SmartPlatform.token");
|
||||
HttpPost postRequest = new HttpPost(requestURL); //POST 메소드 URL 새성
|
||||
postRequest.setHeader("Accept", "application/json");
|
||||
postRequest.setHeader("BROKER_TOKEN", token);
|
||||
List<NameValuePair> pairs = new ArrayList<>();
|
||||
Iterator<String> keys = reqData.keySet().iterator();
|
||||
while (keys.hasNext()) {
|
||||
String key = keys.next();
|
||||
pairs.add(new BasicNameValuePair(key, (String) reqData.get(key)));
|
||||
}
|
||||
postRequest.setEntity(new UrlEncodedFormEntity(pairs, "UTF-8"));
|
||||
HttpResponse response = client.execute(postRequest);
|
||||
//Response 출력
|
||||
if (response.getStatusLine().getStatusCode() == 200) {
|
||||
ResponseHandler<String> handler = new BasicResponseHandler();
|
||||
String body = handler.handleResponse(response);
|
||||
JSONParser parser = new JSONParser();
|
||||
Object obj = parser.parse(body);
|
||||
JSONObject jsonObj = (JSONObject) obj;
|
||||
JSONObject data = (JSONObject) jsonObj.get("data");
|
||||
JSONArray dataArr = (JSONArray) data.get("resp");
|
||||
logger.info("body::" + jsonObj.toJSONString());
|
||||
if (jsonObj.get("result").equals("SUCCESS")) {
|
||||
if (jsonObj.get("resultCode").equals("0000")) {
|
||||
if (dataArr != null && dataArr.size() > 0) {
|
||||
result.put("rspnsResult", "S");
|
||||
result.put("data", dataArr);
|
||||
} else if (dataArr != null && dataArr.size() == 0) {
|
||||
result.put("rspnsResult", "N");
|
||||
} else {
|
||||
result.put("rspnsResult", "W");
|
||||
}
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
}
|
||||
result.put("rspnsCode", jsonObj.get("resultCode"));
|
||||
result.put("rspnsMssage", jsonObj.get("resultMessage"));
|
||||
} else {
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", jsonObj.get("resultMessage"));
|
||||
}
|
||||
|
||||
} else {
|
||||
logger.error("response is error : " + response.getStatusLine().getStatusCode());
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "response is error");
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "시스템 오류가 발생하였습니다.");
|
||||
} catch (Exception e) {
|
||||
logger.error("errorMessage::" + "", e);
|
||||
result.put("rspnsResult", "E");
|
||||
result.put("rspnsCode", "9999");
|
||||
result.put("rspnsMssage", "연결 오류가 발생하였습니다.");
|
||||
} finally {
|
||||
try {
|
||||
client.close();
|
||||
} catch (IOException io) {
|
||||
logger.error("[process error::" + "" + "]", io);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int vhcleChk(Map param) {
|
||||
return joinMapper.vhcleChk(param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,390 @@
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.gpki.gpkiapi_jni;
|
||||
import com.gpki.gpkiapi.GpkiApi;
|
||||
import com.gpki.gpkiapi.cert.X509Certificate;
|
||||
import com.gpki.gpkiapi.crypto.PrivateKey;
|
||||
import com.gpki.gpkiapi.exception.GpkiApiException;
|
||||
import com.gpki.gpkiapi.storage.Disk;
|
||||
|
||||
public class NewGpkiUtil {
|
||||
private static Logger logger = Logger.getLogger(NewGpkiUtil.class);
|
||||
byte[] myEnvCert, myEnvKey, mySigCert, mySigKey;
|
||||
private Map<String, X509Certificate> targetServerCertMap = new HashMap<String, X509Certificate>();
|
||||
|
||||
// properties
|
||||
private String myServerId;
|
||||
private String targetServerIdList;
|
||||
private String envCertFilePathName;
|
||||
private String envPrivateKeyFilePathName;
|
||||
private String envPrivateKeyPasswd;
|
||||
private String sigCertFilePathName;
|
||||
private String sigPrivateKeyFilePathName;
|
||||
private String sigPrivateKeyPasswd;
|
||||
private String certFilePath;
|
||||
private String gpkiLicPath = ".";
|
||||
private boolean isLDAP = true;
|
||||
private boolean testGPKI = false;
|
||||
|
||||
|
||||
public void init() throws RuntimeException, Exception {
|
||||
GpkiApi.init(gpkiLicPath);
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
if(logger.isDebugEnabled()){
|
||||
if(gpki.API_GetInfo()==0)
|
||||
logger.debug(gpki.sReturnString);
|
||||
else
|
||||
logger.error(gpki.sDetailErrorString);
|
||||
}
|
||||
if(targetServerIdList!=null){
|
||||
String certIdList[] = targetServerIdList.split(",");
|
||||
for(int i = 0 ; i < certIdList.length ; i++){
|
||||
String certId = certIdList[i].trim();
|
||||
if(!certId.equals("")){
|
||||
load(gpki, certId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
logger.info("Loading gpki certificate : myServerId="
|
||||
+ this.getMyServerId());
|
||||
|
||||
X509Certificate _myEnvCert = Disk.readCert(this
|
||||
.getEnvCertFilePathName());
|
||||
myEnvCert = _myEnvCert.getCert();
|
||||
|
||||
PrivateKey _myEnvKey = Disk.readPriKey(this
|
||||
.getEnvPrivateKeyFilePathName(), this.getEnvPrivateKeyPasswd());
|
||||
myEnvKey = _myEnvKey.getKey();
|
||||
|
||||
X509Certificate _mySigCert = Disk.readCert(this
|
||||
.getSigCertFilePathName());
|
||||
mySigCert = _mySigCert.getCert();
|
||||
|
||||
PrivateKey _mySigKey = Disk.readPriKey(this
|
||||
.getSigPrivateKeyFilePathName(), this.getSigPrivateKeyPasswd());
|
||||
mySigKey = _mySigKey.getKey();
|
||||
|
||||
//test my cert GPKI
|
||||
if(testGPKI){
|
||||
load(gpki, this.getMyServerId());
|
||||
testGpki(gpki);
|
||||
}
|
||||
this.finish(gpki);
|
||||
logger.info("GpkiUtil initialized");
|
||||
}
|
||||
|
||||
private void load(gpkiapi_jni gpki, String certId) throws RuntimeException, Exception {
|
||||
|
||||
logger.debug("Loading gpki certificate : targetServerId="
|
||||
+ certId);
|
||||
|
||||
X509Certificate cert = targetServerCertMap.get(certId);
|
||||
if (cert != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLDAP) {
|
||||
String ldapUrl = "ldap://10.1.7.118:389/cn=";
|
||||
String ldapUri;
|
||||
if (certId.charAt(3) > '9') {
|
||||
ldapUri = ",ou=Group of Server,o=Public of Korea,c=KR";
|
||||
} else {
|
||||
ldapUri = ",ou=Group of Server,o=Government of Korea,c=KR";
|
||||
}
|
||||
|
||||
int ret = gpki.LDAP_GetAnyDataByURL("userCertificate;binary", ldapUrl + certId + ldapUri);
|
||||
this.checkResult(ret, gpki);
|
||||
cert = new X509Certificate(gpki.baReturnArray);
|
||||
} else {
|
||||
if(certFilePath != null){
|
||||
cert = Disk.readCert(certFilePath + File.separator + certId + ".cer");
|
||||
}else{
|
||||
logger.debug("not certFilePath");
|
||||
}
|
||||
}
|
||||
|
||||
targetServerCertMap.put(certId, cert);
|
||||
}
|
||||
|
||||
private gpkiapi_jni getGPKI(){
|
||||
gpkiapi_jni gpki = new gpkiapi_jni();
|
||||
if(gpki.API_Init(gpkiLicPath) != 0){
|
||||
logger.error(gpki.sDetailErrorString);
|
||||
}
|
||||
return gpki;
|
||||
}
|
||||
private void finish(gpkiapi_jni gpki){
|
||||
if(gpki.API_Finish() != 0){
|
||||
logger.error(gpki.sDetailErrorString);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] encrypt(byte[] plain, String certId , boolean load) throws RuntimeException, Exception {
|
||||
X509Certificate targetEnvCert = targetServerCertMap.get(certId);
|
||||
if (targetEnvCert == null) {
|
||||
throw new RuntimeException("Certificate not found : targetServerId=" + certId);
|
||||
}
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.CMS_MakeEnvelopedData(targetEnvCert.getCert(), plain,
|
||||
gpkiapi_jni.SYM_ALG_NEAT_CBC);
|
||||
checkResult(result, "Fail to encrypt message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.baReturnArray;
|
||||
}
|
||||
|
||||
public byte[] encrypt(byte[] plain, String certId) throws RuntimeException, Exception {
|
||||
return encrypt(plain,certId , false);
|
||||
}
|
||||
|
||||
public byte[] decrypt(byte[] encrypted) throws RuntimeException, Exception {
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.CMS_ProcessEnvelopedData(myEnvCert, myEnvKey,
|
||||
encrypted);
|
||||
checkResult(result, "Fail to decrpyt message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.baReturnArray;
|
||||
}
|
||||
|
||||
public byte[] sign(byte[] plain) {
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.CMS_MakeSignedData(mySigCert, mySigKey, plain, null);
|
||||
checkResult(result, "Fail to sign message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.baReturnArray;
|
||||
}
|
||||
|
||||
public byte[] validate(byte[] signed) {
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.CMS_ProcessSignedData(signed);
|
||||
checkResult(result, "Fail to validate signed message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.baData;
|
||||
}
|
||||
|
||||
public String encode(byte[] plain) throws RuntimeException, Exception {
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.BASE64_Encode(plain);
|
||||
checkResult(result, "Fail to encode message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.sReturnString;
|
||||
}
|
||||
|
||||
public byte[] decode(String base64) throws RuntimeException, Exception {
|
||||
|
||||
gpkiapi_jni gpki = this.getGPKI();
|
||||
try{
|
||||
int result = gpki.BASE64_Decode(base64);
|
||||
checkResult(result, "Fail to decode base64 message", gpki);
|
||||
}catch(RuntimeException e){
|
||||
logger.info(e);
|
||||
}catch(Exception e){
|
||||
logger.info(e);
|
||||
}finally{
|
||||
finish(gpki);
|
||||
}
|
||||
return gpki.baReturnArray;
|
||||
}
|
||||
|
||||
private void checkResult(int result, gpkiapi_jni gpki)throws RuntimeException, Exception{
|
||||
this.checkResult(result, null, gpki);
|
||||
}
|
||||
|
||||
private void checkResult(int result ,String message, gpkiapi_jni gpki)throws RuntimeException, Exception{
|
||||
if( 0 != result){
|
||||
if(null != gpki){
|
||||
throw new RuntimeException(message + " : gpkiErrorMessage=" + gpki.sDetailErrorString);
|
||||
}else{
|
||||
throw new RuntimeException(message + " : gpkiErrorCode=" + result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void testGpki(gpkiapi_jni gpki) throws RuntimeException, Exception{
|
||||
//gpki test eng
|
||||
logger.info("=======================================================");
|
||||
logger.info("================ TEST GPKI START ======================");
|
||||
logger.info("=======================================================");
|
||||
String original_Eng = "abc";
|
||||
logger.info("=== TEST ENG STRING: "+ original_Eng);
|
||||
try {
|
||||
byte[] encrypted = encrypt(original_Eng.getBytes(), myServerId);
|
||||
logger.info("=== TEST ENG ENCRYPT STRING: "+ encode(encrypted));
|
||||
String decrypted = new String(decrypt(encrypted));
|
||||
logger.info("=== TEST ENG DECRYPT STRING: "+decrypted);
|
||||
|
||||
if (!original_Eng.equals(decrypted)) {
|
||||
throw new RuntimeException("GpkiUtil not initialized properly(english)");
|
||||
}
|
||||
logger.info("=== TEST ENG: OK");
|
||||
} catch (RuntimeException e) {
|
||||
logger.info("Gpki Test error(english)", e);
|
||||
} catch (Exception e) {
|
||||
logger.info("Gpki Test error(english)", e);
|
||||
}
|
||||
//gpki test kor
|
||||
String original = "한글테스트";
|
||||
logger.info("=== TEST KOR STRING: "+ original);
|
||||
try {
|
||||
byte[] encrypted = encrypt(original.getBytes(), myServerId);
|
||||
logger.info("=== TEST KOR ENCRYPT STRING: "+ encode(encrypted));
|
||||
String decrypted = new String(decrypt(encrypted));
|
||||
logger.info("=== TEST KOR DECRYPT STRING: "+decrypted);
|
||||
if (!original.equals(decrypted)) {
|
||||
throw new RuntimeException("GpkiUtil not initialized properly(korean)");
|
||||
}
|
||||
logger.info("=== TEST KOR: OK");
|
||||
} catch (RuntimeException e) {
|
||||
logger.warn("Gpki Test error(korean)", e);
|
||||
} catch (Exception e) {
|
||||
logger.warn("Gpki Test error(korean)", e);
|
||||
}finally{
|
||||
logger.info("=======================================================");
|
||||
logger.info("================ TEST GPKI END ========================");
|
||||
logger.info("=======================================================");
|
||||
}
|
||||
}
|
||||
|
||||
public String getMyServerId() {
|
||||
return myServerId;
|
||||
}
|
||||
|
||||
public void setMyServerId(String myServerId) {
|
||||
this.myServerId = myServerId.trim();
|
||||
}
|
||||
|
||||
public String getEnvCertFilePathName() {
|
||||
return envCertFilePathName;
|
||||
}
|
||||
|
||||
public void setEnvCertFilePathName(String envCertFilePathName) {
|
||||
this.envCertFilePathName = envCertFilePathName.trim();
|
||||
}
|
||||
|
||||
public String getEnvPrivateKeyFilePathName() {
|
||||
return envPrivateKeyFilePathName;
|
||||
}
|
||||
|
||||
public void setEnvPrivateKeyFilePathName(String envPrivateKeyFilePathName) {
|
||||
this.envPrivateKeyFilePathName = envPrivateKeyFilePathName.trim();
|
||||
}
|
||||
|
||||
public String getEnvPrivateKeyPasswd() {
|
||||
return envPrivateKeyPasswd;
|
||||
}
|
||||
|
||||
public void setEnvPrivateKeyPasswd(String envPrivateKeyPasswd) {
|
||||
this.envPrivateKeyPasswd = envPrivateKeyPasswd.trim();
|
||||
}
|
||||
|
||||
public String getSigPrivateKeyPasswd() {
|
||||
return sigPrivateKeyPasswd;
|
||||
}
|
||||
|
||||
public void setSigPrivateKeyPasswd(String sigPrivateKeyPasswd) {
|
||||
this.sigPrivateKeyPasswd = sigPrivateKeyPasswd.trim();
|
||||
}
|
||||
|
||||
public String getSigCertFilePathName() {
|
||||
return sigCertFilePathName;
|
||||
}
|
||||
|
||||
public void setSigCertFilePathName(String sigCertFilePathName) {
|
||||
this.sigCertFilePathName = sigCertFilePathName.trim();
|
||||
}
|
||||
|
||||
public String getSigPrivateKeyFilePathName() {
|
||||
return sigPrivateKeyFilePathName;
|
||||
}
|
||||
|
||||
public void setSigPrivateKeyFilePathName(String sigPrivateKeyFilePathName) {
|
||||
this.sigPrivateKeyFilePathName = sigPrivateKeyFilePathName.trim();
|
||||
}
|
||||
|
||||
public boolean getIsLDAP() {
|
||||
return isLDAP;
|
||||
}
|
||||
|
||||
public void setIsLDAP(boolean isLDAP) {
|
||||
this.isLDAP = isLDAP;
|
||||
}
|
||||
|
||||
public String getCertFilePath() {
|
||||
return certFilePath;
|
||||
}
|
||||
|
||||
public void setCertFilePath(String certFilePath) {
|
||||
this.certFilePath = certFilePath.trim();
|
||||
}
|
||||
|
||||
public String getTargetServerIdList() {
|
||||
return targetServerIdList;
|
||||
}
|
||||
|
||||
public void setTargetServerIdList(String targetServerIdList) {
|
||||
this.targetServerIdList = targetServerIdList;
|
||||
}
|
||||
|
||||
public String getGpkiLicPath() {
|
||||
return gpkiLicPath;
|
||||
}
|
||||
|
||||
public void setGpkiLicPath(String gpkiLicPath) {
|
||||
this.gpkiLicPath = gpkiLicPath;
|
||||
}
|
||||
|
||||
public boolean getTestGPKI() {
|
||||
return testGPKI;
|
||||
}
|
||||
|
||||
public void setTestGPKI(boolean testGPKI) {
|
||||
this.testGPKI = testGPKI;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
/**
|
||||
* @Class Name : PublicFacilityReqXml.java
|
||||
* @Description : 공공시설 감면 웹서비스 호출을 위한 xml 조립
|
||||
* @Version 1.0
|
||||
* @Since 2019. 05. 25
|
||||
* @Author 박영수
|
||||
* <pre>
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
*
|
||||
|
||||
* </pre>
|
||||
*/
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
|
||||
/**
|
||||
* @Class Name : PublicFacilityReqXml.java
|
||||
* @Description : 공공시설 감면 웹서비스 호출을 위한 xml 조립
|
||||
* @Since 2019. 05. 25
|
||||
* @Author 박영수
|
||||
* <pre>
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
*
|
||||
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
||||
@Component
|
||||
public class PublicFacilityReqXml {
|
||||
|
||||
static Logger logger = Logger.getLogger(PublicFacilityReqXml.class.getName());
|
||||
|
||||
/**
|
||||
* xmlHeader부 생성
|
||||
* @param strXmlNs : xmlns명
|
||||
*/
|
||||
public String commonHeaderXml(String strXmlNs, String strServiceName, String strSysId)
|
||||
{
|
||||
String strCertServerId=null;
|
||||
String strUseSystemCode = null;
|
||||
String strUserDeptCode = null;
|
||||
String strUserName = null;
|
||||
if(strSysId.equals("11-004")){//공영주차장
|
||||
strCertServerId = "SVRB553774006";
|
||||
if("ResideInsttCnfirmService".equals(strServiceName)) {
|
||||
strUseSystemCode = "FD2401090024601";
|
||||
} else {
|
||||
strUseSystemCode = "B553774CMC"; //ESBTEST
|
||||
}
|
||||
strUserDeptCode = "B553774";
|
||||
strUserName = "공영주차장";
|
||||
}
|
||||
|
||||
logger.info("strUseSystemCode:: : " + strUseSystemCode);
|
||||
|
||||
String strTransactionUniqueId = "";
|
||||
|
||||
int iRndGidits = 8;
|
||||
Date d = new Date();
|
||||
SimpleDateFormat mDate = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
||||
//logger.debug("mDate " + mDate);
|
||||
Random rand = new Random();
|
||||
String numStr = "";
|
||||
|
||||
for(int i=0;i<iRndGidits;i++) {
|
||||
String ran = Integer.toString(rand.nextInt(10));
|
||||
if(!numStr.contains(ran)) {
|
||||
numStr += ran;
|
||||
}else {
|
||||
i-=1;
|
||||
}
|
||||
}
|
||||
|
||||
strTransactionUniqueId = mDate.format(d) + numStr;
|
||||
StringBuffer strSbXml = new StringBuffer();
|
||||
strSbXml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\t\n");
|
||||
strSbXml.append("<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\">\n");
|
||||
strSbXml.append(" <Header>\n");
|
||||
strSbXml.append(" <commonHeader xmlns=\""+ strXmlNs +"\">\n");
|
||||
strSbXml.append(" <serviceName>" + strServiceName + "</serviceName>\n"); //서비스명
|
||||
strSbXml.append(" <useSystemCode>" + strUseSystemCode +"</useSystemCode>\n"); //이용시스템 코드
|
||||
strSbXml.append(" <certServerId>" + strCertServerId + "</certServerId>\n"); //GPKI 인증서 아이디
|
||||
strSbXml.append(" <transactionUniqueId>" + strTransactionUniqueId + "</transactionUniqueId>\n"); //트랜잭션 유일식별자
|
||||
strSbXml.append(" <userDeptCode>" + strUserDeptCode + "</userDeptCode>\n"); //이용자 부서코드
|
||||
strSbXml.append(" <userName>" + strUserName + "</userName>\n"); //이용자명
|
||||
strSbXml.append(" </commonHeader>\n");
|
||||
strSbXml.append(" </Header>\n");
|
||||
|
||||
return strSbXml.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 관내주민여부확인
|
||||
* @param facMap : in Param
|
||||
*/
|
||||
public HashMap<String, Object> getResideInsttCnfirmXml(HashMap facMap)
|
||||
{
|
||||
HashMap<String, Object> reqXmlMap = new HashMap<>();
|
||||
String strXmlNs = "http://ccais.mopas.go.kr/dh/jmn/services/jumin/ResideInsttCnfirm/types";
|
||||
String strElement = "getResideInsttCnfirm";
|
||||
String strElementResp = "getResideInsttCnfirmResponse";
|
||||
String strServiceName = "ResideInsttCnfirmService";
|
||||
|
||||
StringBuffer strSbXml = new StringBuffer();
|
||||
strSbXml.append(commonHeaderXml(strXmlNs, strServiceName, (String)facMap.get("sysId")));
|
||||
strSbXml.append(" <Body>\n");
|
||||
strSbXml.append(" <" + strElement + " xmlns=\"" +strXmlNs+ "\">\n");
|
||||
strSbXml.append(" <orgCode>" + (String)facMap.get("orgCode") + "</orgCode>\n"); //기관코드
|
||||
strSbXml.append(" <id>" + (String)facMap.get("id") + "</id>\n"); //주민등록번호
|
||||
strSbXml.append(" <name>" + (String)facMap.get("name") + "</name>\n"); //성명
|
||||
strSbXml.append(" </" + strElement + ">\n");
|
||||
strSbXml.append(" </Body>\n");
|
||||
strSbXml.append("</Envelope>\n");
|
||||
|
||||
String strReqXml = strSbXml.toString();
|
||||
String strReqBodyMessage = strReqXml.split("<" + strElement + " xmlns=\"" +strXmlNs+ "\">")[1].split("</" + strElement + ">")[0];
|
||||
|
||||
reqXmlMap.put("reqXml", strReqXml);
|
||||
reqXmlMap.put("reqBodyMessage", strReqBodyMessage);
|
||||
reqXmlMap.put("xmlNs", strXmlNs);
|
||||
reqXmlMap.put("elementResp", strElementResp);
|
||||
|
||||
return reqXmlMap;
|
||||
}
|
||||
|
||||
//Tag값 정보 가져오는 메서드
|
||||
public static String getTagValue(String tag, Element eElement) {
|
||||
if( eElement.getElementsByTagName(tag).getLength() == 0)
|
||||
return null;
|
||||
NodeList nlList = eElement.getElementsByTagName(tag).item(0).getChildNodes();
|
||||
Node nValue = (Node) nlList.item(0);
|
||||
if(nValue == null)
|
||||
return null;
|
||||
return nValue.getNodeValue();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
/**
|
||||
* @Class Name : PublicFacilitySend.java
|
||||
* @Description : 공공시설 감면 웹서비스 호출
|
||||
* @Version 1.0
|
||||
* @Since 2019. 05. 25
|
||||
* @Author 박영수
|
||||
* <pre>
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
*
|
||||
|
||||
* </pre>
|
||||
*/
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler;
|
||||
import org.apache.commons.httpclient.HttpClient;
|
||||
import org.apache.commons.httpclient.HttpConnectionManager;
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
|
||||
import org.apache.commons.httpclient.methods.PostMethod;
|
||||
import org.apache.commons.httpclient.methods.RequestEntity;
|
||||
import org.apache.commons.httpclient.methods.StringRequestEntity;
|
||||
import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
|
||||
import org.apache.commons.httpclient.params.HttpMethodParams;
|
||||
|
||||
import websquare.logging.Logger;
|
||||
|
||||
/**
|
||||
* @Class Name : PublicFacilitySend.java
|
||||
* @Description : 공공시설 감면 웹서비스 호출
|
||||
* @Since 2019. 05. 25
|
||||
* @Author 박영수
|
||||
* <pre>
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------------- ----------------------
|
||||
*
|
||||
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public abstract class PublicFacilitySend {
|
||||
|
||||
/**
|
||||
* 행안부 웹서비스 호출
|
||||
*/
|
||||
public static String doService(String serviceUrl, String requestXml) {
|
||||
Logger.info("[거주지] 행안부 호출 시작");
|
||||
String strContentType;
|
||||
String strEndoding;
|
||||
int iConnectTimeout;
|
||||
int iSoTimeout;
|
||||
{
|
||||
strContentType = "text/xml; charset=utf-8";
|
||||
strEndoding = "UTF-8";
|
||||
|
||||
iConnectTimeout = 5 * 60 * 1000;
|
||||
iSoTimeout = 900 * 1000;
|
||||
}
|
||||
|
||||
PostMethod method = null;
|
||||
String strRespXml = null;
|
||||
ByteArrayOutputStream baos = null;
|
||||
try {
|
||||
Logger.info("[거주지] 행안부 호출 httpClient");
|
||||
HttpClient client;
|
||||
{
|
||||
Logger.info("[거주지] 행안부 호출 params");
|
||||
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
|
||||
|
||||
params.setConnectionTimeout(iConnectTimeout);
|
||||
params.setSoTimeout(iSoTimeout);
|
||||
params.setTcpNoDelay(true);
|
||||
Logger.info("[거주지] 행안부 호출 params2");
|
||||
HttpConnectionManager conn = new SimpleHttpConnectionManager();
|
||||
conn.setParams(params);
|
||||
client = new HttpClient(conn);
|
||||
Logger.info("[거주지] 행안부 호출 client");
|
||||
method = new PostMethod(serviceUrl);
|
||||
Logger.info("[거주지] 행안부 호출 method");
|
||||
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
|
||||
new DefaultHttpMethodRetryHandler(0, false));
|
||||
|
||||
method.setRequestHeader("Content-Type", strContentType);
|
||||
method.setRequestHeader("Connection", "close");
|
||||
|
||||
RequestEntity requestEntity = new StringRequestEntity(
|
||||
requestXml, strContentType, strEndoding);
|
||||
Logger.info("[거주지] requestEntity -> " + requestEntity.toString());
|
||||
method.setRequestEntity(requestEntity);
|
||||
Logger.info("[거주지] method -> " + method.toString());
|
||||
}
|
||||
|
||||
int iResponseCode = client.executeMethod(method);
|
||||
{
|
||||
InputStream is = method.getResponseBodyAsStream();
|
||||
|
||||
try {
|
||||
int readLen;
|
||||
byte[] buffer = new byte[1024];
|
||||
baos = new ByteArrayOutputStream();
|
||||
while ((readLen = is.read(buffer)) >= 0) {
|
||||
baos.write(buffer, 0, readLen);
|
||||
}
|
||||
byte[] data = baos.toByteArray();
|
||||
strRespXml = new String(data, strEndoding);
|
||||
} catch (IOException e) {
|
||||
Logger.info("에러발생");
|
||||
} catch (Exception e) {
|
||||
Logger.info("에러발생");
|
||||
} finally {
|
||||
is.close();
|
||||
if(baos != null){
|
||||
try {
|
||||
baos.close();
|
||||
} catch (IOException e) {
|
||||
Logger.info("에러");
|
||||
} catch (Exception e) {
|
||||
Logger.info("에러");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (iResponseCode == HttpStatus.SC_OK) {
|
||||
//
|
||||
// } else if (strRespXml.indexOf("Fault>") > 0) {
|
||||
// //오류처리...실데이터가 어떤식으로 오는지...암호화 안하고 오면은....
|
||||
// } else {
|
||||
// }
|
||||
} catch (RuntimeException e) {
|
||||
Logger.info("에러발생");
|
||||
} catch (Exception e) {
|
||||
Logger.info("에러발생");
|
||||
} finally {
|
||||
if (method != null) {
|
||||
method.releaseConnection();
|
||||
}
|
||||
}
|
||||
|
||||
return strRespXml;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,81 @@
|
||||
package gtpa.brs.join.service.impl;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ShareGpki {
|
||||
|
||||
static Logger logger = Logger.getLogger(ShareGpki.class.getName());
|
||||
|
||||
public static NewGpkiUtil getGpkiUtil(String targetServerId, String strSysId, boolean isRealIp) throws RuntimeException, Exception{
|
||||
NewGpkiUtil g = new NewGpkiUtil();
|
||||
// 이용기관 서버CN
|
||||
String myServerId = null;
|
||||
// 이용기관 서버인증서 경로
|
||||
String envCertFilePathName = null;
|
||||
String envPrivateKeyFilePathName = null;
|
||||
// 서버인증서 비밀번호
|
||||
String envPrivateKeyPasswd = null;
|
||||
// 이용기관 서버전자서명 경로
|
||||
String sigCertFilePathName = null;
|
||||
String sigPrivateKeyFilePathName = null;
|
||||
// 이용기관 서버전자서명 비밀번호
|
||||
String sigPrivateKeyPasswd = null;
|
||||
String strGpkiPath = null;
|
||||
logger.info("GPKI 경로 운영?: " + strGpkiPath);
|
||||
if(isRealIp){
|
||||
strGpkiPath = "/gpta/source-app/fis/gpki/Certificate/";
|
||||
}else{
|
||||
strGpkiPath = "C:/gpki/Certificate/";
|
||||
}
|
||||
|
||||
if(strSysId.equals("11-004")){//공영주차장
|
||||
myServerId = "SVRB553774006";
|
||||
|
||||
envCertFilePathName = strGpkiPath + "park/SVRB553774006_env.cer";
|
||||
envPrivateKeyFilePathName = strGpkiPath + "park/SVRB553774006_env.key";
|
||||
envPrivateKeyPasswd = "sisulwnck1!";
|
||||
|
||||
sigCertFilePathName = strGpkiPath + "park/SVRB553774006_sig.cer";
|
||||
sigPrivateKeyFilePathName = strGpkiPath + "park/SVRB553774006_sig.key";
|
||||
sigPrivateKeyPasswd = "sisulwnck1!";
|
||||
g.setCertFilePath(strGpkiPath + "park");
|
||||
// 이용기관 GPKI API 라이선스파일 경로
|
||||
g.setGpkiLicPath(strGpkiPath + "park");
|
||||
}else if(strSysId.equals("11-006")){//과태료
|
||||
myServerId = "SVR6113918001";
|
||||
|
||||
envCertFilePathName = strGpkiPath + "fis/SVR6113918001_env.cer";
|
||||
envPrivateKeyFilePathName = strGpkiPath + "fis/SVR6113918001_env.key";
|
||||
envPrivateKeyPasswd = "tjfdlfghks&1";
|
||||
|
||||
sigCertFilePathName = strGpkiPath + "fis/SVR6113918001_sig.cer";
|
||||
sigPrivateKeyFilePathName = strGpkiPath + "fis/SVR6113918001_sig.key";
|
||||
sigPrivateKeyPasswd = "tjfdlfghks&1";
|
||||
g.setCertFilePath(strGpkiPath + "fis");
|
||||
// 이용기관 GPKI API 라이선스파일 경로
|
||||
g.setGpkiLicPath(strGpkiPath + "fis");
|
||||
}else{
|
||||
throw new RuntimeException("SysId오류");
|
||||
}
|
||||
|
||||
g.setEnvCertFilePathName(envCertFilePathName);
|
||||
g.setEnvPrivateKeyFilePathName(envPrivateKeyFilePathName);
|
||||
g.setEnvPrivateKeyPasswd(envPrivateKeyPasswd);
|
||||
// LDAP 의 사용유무
|
||||
// 미사용일 경우 암호화할 타겟의 인증서를 파일로 저장해놓고 사용하여야함.
|
||||
g.setIsLDAP(true);
|
||||
g.setMyServerId(myServerId);
|
||||
g.setSigCertFilePathName(sigCertFilePathName);
|
||||
g.setSigPrivateKeyFilePathName(sigPrivateKeyFilePathName);
|
||||
g.setSigPrivateKeyPasswd(sigPrivateKeyPasswd);
|
||||
|
||||
g.setTargetServerIdList(targetServerId);
|
||||
|
||||
g.init();
|
||||
return g;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,453 @@
|
||||
package gtpa.brs.join.web;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import gtpa.brs.join.service.CACheckService;
|
||||
import gtpa.brs.join.service.JoinService;
|
||||
import gtpa.brs.user.dto.TempUserSessionInfoDTO;
|
||||
import gtpa.brs.user.dto.UserInfo;
|
||||
import gtpa.brs.util.BrsIdGnrUtil;
|
||||
import gtpa.brs.util.Result;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 18/04/2019
|
||||
* TIME : 4:08 PM
|
||||
* Project : BRSPW
|
||||
* Class : CACheckController
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@SuppressFBWarnings
|
||||
@Controller
|
||||
public class CACheckController {
|
||||
|
||||
@Autowired
|
||||
CACheckService caCheckService;
|
||||
|
||||
@Autowired
|
||||
JoinService joinService;
|
||||
|
||||
/* @Autowired
|
||||
TempUserSessionInfoDTO tempUserSessionDTO;*/
|
||||
|
||||
@Autowired
|
||||
UserInfo userInfo;
|
||||
|
||||
@Resource(name = "memberGenIDService")
|
||||
BrsIdGnrUtil memberGenIDService;
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
Properties env;
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(CACheckController.class);
|
||||
|
||||
@RequestMapping(value = "/check/isExsistComp.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Map<String, Object> isExsistComp(@RequestBody Map<String, Object> param, HttpServletRequest request) {
|
||||
TempUserSessionInfoDTO sessionInfoDTO = (TempUserSessionInfoDTO) request.getSession().getAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
Map<String, Object> data;
|
||||
Result result = new Result();
|
||||
Map<String, Object> params = (Map) param.get("searchParam");
|
||||
logger.info("Param Data : " + param);
|
||||
String compRepNm = (String) params.get("compRepNm");
|
||||
String entprsNm = (String) params.get("entrprsNm");
|
||||
String bsnmRegistNo1 = (String) params.get("bsnmRegistNo1");
|
||||
String bsnmRegistNo2 = (String) params.get("bsnmRegistNo2");
|
||||
String bsnmRegistNo3 = (String) params.get("bsnmRegistNo3");
|
||||
String bsnmRegistNo = bsnmRegistNo1 + bsnmRegistNo2 + bsnmRegistNo3;
|
||||
try {
|
||||
data = caCheckService.isExsistComp(bsnmRegistNo, "", entprsNm, compRepNm);
|
||||
result.setData("data", data);
|
||||
if ((Integer) data.get("iReturn") != 0) {
|
||||
result.setMsg(result.STATUS_ERROR, "사업자가 확인되지 않았습니다.");
|
||||
} else {
|
||||
if (data.get("RETURN_CODE").equals("01") && data.get("STATUS_CODE").equals("0")
|
||||
||
|
||||
data.get("RETURN_CODE").equals("01") && data.get("STATUS_CODE").equals("1")
|
||||
||
|
||||
data.get("RETURN_CODE").equals("23") && data.get("STATUS_CODE").equals("0")) {
|
||||
result.setMsg(result.STATUS_SUCESS, "사업자 인증이 완료되었습니다.");
|
||||
sessionInfoDTO.setTempUserInfo(data);
|
||||
} else if (!data.get("STATUS_CODE").equals("0") || !data.get("STATUS_CODE").equals("1")) {
|
||||
result.setMsg(result.STATUS_ERROR, "사업자가 확인되지 않았습니다.");
|
||||
} else {
|
||||
result.setMsg(result.STATUS_ERROR, "사업자가 확인되지 않았습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/phone/main.do", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
Map<String, Object> phoneCheckplus(HttpServletRequest request) {
|
||||
Result result = caCheckService.checkPlusMain(request, "M");
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/phone/success.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public void phoneCheckplusSuccess(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
TempUserSessionInfoDTO sessionInfoDTO = (TempUserSessionInfoDTO) request.getSession().getAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
Map data = caCheckService.checkPlusSuccess(request, "M");
|
||||
String sConnInfo = (String) data.get("sConnInfo");
|
||||
String sName = (String) data.get("sName");
|
||||
String sMessage = (String) data.get("sMessage");
|
||||
String sNationalInfo = (String) data.get("sNationalInfo");
|
||||
String sBirthDate = (String) data.get("sBirthDate");
|
||||
String sMobileNo = (String) data.get("sMobileNo");
|
||||
String sMobileCo = (String) data.get("sMobileCo");
|
||||
int iReturn = (Integer) data.get("iReturn");
|
||||
Map param = new HashMap();
|
||||
param.put("MBER_CI", sConnInfo);
|
||||
if (sessionInfoDTO != null && sessionInfoDTO.getMberty() != null) {
|
||||
param.put("MBER_TY", sessionInfoDTO.getMberty());
|
||||
}
|
||||
Map rsltMap = joinService.isMemberExsist(param);
|
||||
response.setStatus(200);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
if (rsltMap != null) {
|
||||
request.getSession().removeAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
request.getSession().invalidate();
|
||||
sMessage = "이미 등록되어 있는 사용자 입니다.";
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.exsitMbPopup('" + rsltMap.get("MBER_ID") + "','" + rsltMap.get("MBER_NM") + "','" + rsltMap.get("SBSCRB_DT") + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
/*response.getWriter().print("<html><script>" +
|
||||
"alert('" + sMessage + "');" +
|
||||
"window.opener.mf_container_scwin.exsitMbPopup('" + rsltMap.get("MBER_ID") + "','" + rsltMap.get("MBER_NM") + "','" + rsltMap.get("SBSCRB_DT") + "');" +
|
||||
"window.close();</script></html>");*/
|
||||
} else {
|
||||
if (sessionInfoDTO != null && sessionInfoDTO.getMberty() != null) {
|
||||
sessionInfoDTO.setMberCi(sConnInfo);
|
||||
if (sessionInfoDTO.getMberty().equals("CP")) {
|
||||
String repNm = (String) sessionInfoDTO.getTempUserInfo().get("RETURN_REPNAME");
|
||||
if (!repNm.equals(sName)) {
|
||||
iReturn = -99;
|
||||
sMessage = "대표자가 일치하지 않습니다.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else {
|
||||
sessionInfoDTO.setMberNm(sName);
|
||||
Map tempData = sessionInfoDTO.getTempUserInfo();
|
||||
if (tempData == null) tempData = new HashMap();
|
||||
tempData.put("sBirthDate", sBirthDate);
|
||||
tempData.put("sMobileNo", sMobileNo);
|
||||
tempData.put("sMobileCo", sMobileCo);
|
||||
sessionInfoDTO.setMberMobileNo(sMobileNo);
|
||||
sessionInfoDTO.setMberBirthDt(sBirthDate);
|
||||
sessionInfoDTO.setTempUserInfo(tempData);
|
||||
sessionInfoDTO.setMberNo(memberGenIDService.makeGnrID());
|
||||
}
|
||||
} else {
|
||||
if (sessionInfoDTO.getMberty().equals("NT") && !sNationalInfo.equals("0")) {
|
||||
iReturn = -99;
|
||||
sMessage = "회원가입 유형을 잘못 선택하셨습니다. 올바른 유형을 선택해 주세요.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else if (sessionInfoDTO.getMberty().equals("FR") && sNationalInfo.equals("0")) {
|
||||
iReturn = -99;
|
||||
sMessage = "회원가입 유형을 잘못 선택하셨습니다. 올바른 유형을 선택해 주세요.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else {
|
||||
sessionInfoDTO.setMberNm(sName);
|
||||
Map tempData = sessionInfoDTO.getTempUserInfo();
|
||||
if (tempData == null) tempData = new HashMap();
|
||||
tempData.put("sBirthDate", sBirthDate);
|
||||
tempData.put("sMobileNo", sMobileNo);
|
||||
tempData.put("sMobileCo", sMobileCo);
|
||||
sessionInfoDTO.setMberMobileNo(sMobileNo);
|
||||
sessionInfoDTO.setMberBirthDt(sBirthDate);
|
||||
sessionInfoDTO.setTempUserInfo(tempData);
|
||||
sessionInfoDTO.setMberNo(memberGenIDService.makeGnrID());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iReturn = -99;
|
||||
sMessage = "처리중 오류가 발생했습니다.";
|
||||
//sessionInfoDTO.setMberCi(null);
|
||||
}
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.caCheckSuccess('" + iReturn + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/phone/fail.do", method = {RequestMethod.GET, RequestMethod.POST})
|
||||
public void phoneCheckplusFail(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map data = caCheckService.checkPlusFail(request, "M");
|
||||
String sMessage = (String) data.get("sMessage");
|
||||
int iReturn = (Integer) data.get("iReturn");
|
||||
|
||||
response.setStatus(200);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.caCheckFailPopup('" + iReturn + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/credit/main.do", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
Map<String, Object> creditCheckplus(HttpServletRequest request) {
|
||||
Result result = caCheckService.checkPlusMain(request, "C");
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/credit/success.do", method = RequestMethod.POST)
|
||||
public void creditCheckplusSuccess(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
TempUserSessionInfoDTO sessionInfoDTO = (TempUserSessionInfoDTO) request.getSession().getAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
Map data = caCheckService.checkPlusSuccess(request, "C");
|
||||
String sConnInfo = (String) data.get("sConnInfo");
|
||||
String sName = (String) data.get("sName");
|
||||
String sMessage = (String) data.get("sMessage");
|
||||
String sNationalInfo = (String) data.get("sNationalInfo");
|
||||
String sBirthDate = (String) data.get("sBirthDate");
|
||||
String sMobileNo = (String) data.get("sMobileNo");
|
||||
String sMobileCo = (String) data.get("sMobileCo");
|
||||
int iReturn = (Integer) data.get("iReturn");
|
||||
Map param = new HashMap();
|
||||
param.put("MBER_CI", sConnInfo);
|
||||
if (sessionInfoDTO != null && sessionInfoDTO.getMberty() != null) {
|
||||
param.put("MBER_TY", sessionInfoDTO.getMberty());
|
||||
}
|
||||
Map rsltMap = joinService.isMemberExsist(param);
|
||||
response.setStatus(200);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
if (rsltMap != null) {
|
||||
request.getSession().removeAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
request.getSession().invalidate();
|
||||
sMessage = "이미 등록되어 있는 사용자 입니다.";
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.exsitMbPopup('" + rsltMap.get("MBER_ID") + "','" + rsltMap.get("MBER_NM") + "','" + rsltMap.get("SBSCRB_DT") + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
} else {
|
||||
if (sessionInfoDTO != null && sessionInfoDTO.getMberty() != null) {
|
||||
sessionInfoDTO.setMberCi(sConnInfo);
|
||||
if (sessionInfoDTO.getMberty().equals("CP")) {
|
||||
String repNm = (String) sessionInfoDTO.getTempUserInfo().get("RETURN_REPNAME");
|
||||
if (!repNm.equals(sName)) {
|
||||
iReturn = -99;
|
||||
sMessage = "대표자가 일치하지 않습니다.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else {
|
||||
sessionInfoDTO.setMberNm(sName);
|
||||
Map tempData = sessionInfoDTO.getTempUserInfo();
|
||||
if (tempData == null) tempData = new HashMap();
|
||||
tempData.put("sBirthDate", sBirthDate);
|
||||
tempData.put("sMobileNo", sMobileNo);
|
||||
tempData.put("sMobileCo", sMobileCo);
|
||||
sessionInfoDTO.setMberMobileNo(sMobileNo);
|
||||
sessionInfoDTO.setMberBirthDt(sBirthDate);
|
||||
sessionInfoDTO.setTempUserInfo(tempData);
|
||||
sessionInfoDTO.setMberNo(memberGenIDService.makeGnrID());
|
||||
}
|
||||
} else {
|
||||
if (sessionInfoDTO.getMberty().equals("NT") && !sNationalInfo.equals("0")) {
|
||||
iReturn = -99;
|
||||
sMessage = "회원가입 유형을 잘못 선택하셨습니다. 올바른 유형을 선택해 주세요.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else if (sessionInfoDTO.getMberty().equals("FR") && sNationalInfo.equals("0")) {
|
||||
iReturn = -99;
|
||||
sMessage = "회원가입 유형을 잘못 선택하셨습니다. 올바른 유형을 선택해 주세요.";
|
||||
sessionInfoDTO.setMberCi(null);
|
||||
} else {
|
||||
sessionInfoDTO.setMberNm(sName);
|
||||
Map tempData = sessionInfoDTO.getTempUserInfo();
|
||||
if (tempData == null) tempData = new HashMap();
|
||||
tempData.put("sBirthDate", sBirthDate);
|
||||
tempData.put("sMobileNo", sMobileNo);
|
||||
tempData.put("sMobileCo", sMobileCo);
|
||||
sessionInfoDTO.setMberMobileNo(sMobileNo);
|
||||
sessionInfoDTO.setMberBirthDt(sBirthDate);
|
||||
sessionInfoDTO.setTempUserInfo(tempData);
|
||||
sessionInfoDTO.setMberNo(memberGenIDService.makeGnrID());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iReturn = -99;
|
||||
sMessage = "처리중 오류가 발생했습니다.";
|
||||
//sessionInfoDTO.setMberCi(null);
|
||||
}
|
||||
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.caCheckSuccess('" + iReturn + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/credit/fail.do", method = RequestMethod.POST)
|
||||
public void creditCheckplusFail(HttpServletRequest request, HttpServletResponse response) {
|
||||
try {
|
||||
Map data = caCheckService.checkPlusFail(request, "C");
|
||||
String sMessage = (String) data.get("sMessage");
|
||||
int iReturn = (Integer) data.get("iReturn");
|
||||
|
||||
response.setStatus(200);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + sMessage + "');");
|
||||
out.println("window.opener.mf_container_scwin.caCheckFailPopup('" + iReturn + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/makeConnInfo.do", method = RequestMethod.POST)
|
||||
public @ResponseBody
|
||||
Map<String, Object> makeConnInfo(@RequestBody Map<String, Object> param, HttpServletRequest request) {
|
||||
TempUserSessionInfoDTO sessionInfoDTO = (TempUserSessionInfoDTO) request.getSession().getAttribute("scopedTarget.tempUserSessionInfoDTO");
|
||||
Result result = new Result();
|
||||
try {
|
||||
Map params = (Map) param.get("tempData");
|
||||
String chargerNiNo = (String) params.get("chargerNiNo");
|
||||
String chargerNm = (String) params.get("chargerNm");
|
||||
Map data = caCheckService.interopService(chargerNiNo);
|
||||
if (!data.get("iRtnCI").equals(1)) {
|
||||
throw new RuntimeException(data.get("iRtnCI_MSG").toString());
|
||||
} else {
|
||||
sessionInfoDTO.setChargerCi(data.get("CI").toString());
|
||||
sessionInfoDTO.setChargerNm(chargerNm);
|
||||
result.setMsg(result.STATUS_SUCESS, result.STATUS_SUCESS_MESSAGE);
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE, re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
result.setMsg(result.STATUS_ERROR, result.STATUS_ERROR_MESSAGE, e);
|
||||
}
|
||||
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/tb/main.do", method = RequestMethod.GET)
|
||||
public @ResponseBody
|
||||
Map<String, Object> tbCheckplus(HttpServletRequest request) {
|
||||
Result result = caCheckService.tbCheckMain(request, userInfo.getUserNo());
|
||||
return result.getResult();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/check/tb/success.do", method = {RequestMethod.POST})
|
||||
public void tbCheckSuccess(HttpServletRequest request, HttpServletResponse response, @RequestParam(name="rData", required=false) String param) {//@RequestBody String param
|
||||
try {
|
||||
System.out.println("param:"+param);
|
||||
JSONParser parser = new JSONParser();
|
||||
Object obj = parser.parse(StringEscapeUtils.unescapeHtml4(StringEscapeUtils.unescapeHtml3(URLDecoder.decode(param, "UTF-8"))));
|
||||
JSONObject rData = (JSONObject) obj;
|
||||
JSONObject frcAddInfo = (JSONObject) rData.get("frcAddInfo");
|
||||
String rstcd = (String) rData.get("rstcd");
|
||||
String rstval = (String) rData.get("rstval");
|
||||
String authKey = (String) rData.get("authKey");
|
||||
String setleMnMno = (String) frcAddInfo.get("setleMnMno");
|
||||
String ccmpKnd = (String) frcAddInfo.get("ccmpKnd");
|
||||
String stcmpNo = (String) frcAddInfo.get("stcmpNo");
|
||||
String setleMnKnd = (String) frcAddInfo.get("setleMnKnd");
|
||||
String ccmpCode = (String) frcAddInfo.get("ccmpCode");
|
||||
|
||||
response.setStatus(200);
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
if ("0000".equals(rstcd)) {
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("window.opener.mf_container_scwin.addTbPopup('" + authKey + "','" + setleMnMno + "','" + setleMnKnd + "','" + ccmpCode + "','" + ccmpKnd + "','" + stcmpNo + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
} else {
|
||||
PrintWriter out = response.getWriter();
|
||||
out.println("<script>");
|
||||
out.println("alert('" + rstval + "');");
|
||||
out.println("window.close();");
|
||||
out.println("</script>");
|
||||
out.flush();
|
||||
}
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,98 @@
|
||||
package gtpa.brs.login.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* The interface Login service.
|
||||
*/
|
||||
public interface LoginService {
|
||||
|
||||
/**
|
||||
* Select member info for login map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
// 사용자 정보 조회 (로그인 체크용도로 사용 )
|
||||
public Map selectMemberInfoForLogin(Map param);
|
||||
|
||||
/**
|
||||
* Is admin boolean.
|
||||
*
|
||||
* @param userId the user id
|
||||
* @return the boolean
|
||||
*/
|
||||
// 해당 사용자 아이디가 관리자 아이디인지를 검사한다.
|
||||
public boolean isAdmin(String userId);
|
||||
|
||||
/**
|
||||
* Update password int.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the int
|
||||
*/
|
||||
// 사용자의 비밀번호를 업데이트한다.
|
||||
public int updatePassword(Map param);
|
||||
|
||||
|
||||
/**
|
||||
* Is member exsist map map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
public Map isMemberExsistMap(Map param);
|
||||
|
||||
/**
|
||||
* Is bsnm member exsist map map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
public Map isBsnmMemberExsistMap(Map param);
|
||||
|
||||
/**
|
||||
* Is member id map map.
|
||||
*
|
||||
* @param mberId the mber id
|
||||
* @return the map
|
||||
*/
|
||||
public Map isMemberIdMap(String mberId);
|
||||
|
||||
public Map isMemberNoMap(String mberNo);
|
||||
|
||||
/**
|
||||
* Update new pwd map.
|
||||
*
|
||||
* @param param the param
|
||||
* @return the map
|
||||
*/
|
||||
public int updateNewPwd(Map param);
|
||||
|
||||
public int saveMnychRdcxptInfo(Map param);
|
||||
|
||||
public int saveNationMrtrsInfo(Map param);
|
||||
|
||||
public Map checkSecsnAt(Map defInfo);
|
||||
|
||||
void insertConnInfo(HashMap param);
|
||||
|
||||
public int chkExsistActNo(Map param);
|
||||
|
||||
int updateFixPwd(Map dbParam);
|
||||
|
||||
void insertPromptErrorConnInfo(Map errLogKey);
|
||||
|
||||
public String selectDisuseMemberInfo(String param);
|
||||
|
||||
public Map selectBackupMemberInfo(String param);
|
||||
|
||||
public String memberInfoUpdt(Map param);
|
||||
|
||||
public String agreAtUpdt(Map param);
|
||||
|
||||
public String backupMberUpdt(String param);
|
||||
|
||||
public String disuseMemberUpdt(String param);
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
package gtpa.brs.login.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository("loginDao")
|
||||
public class LoginMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "LoginDAO";
|
||||
|
||||
// 사용자 정보 조회 (로그인 체크용도로 사용 )
|
||||
public Map selectMemberInfoForLogin(Map param) {
|
||||
return selectOne(NAMESPACE + ".selectMemberInfoForLogin", param);
|
||||
}
|
||||
|
||||
// 사용자의 비밀번호를 업데이트한다.
|
||||
public int updatePassword(Map param) {
|
||||
return update(NAMESPACE + ".updatePassword", param);
|
||||
}
|
||||
|
||||
public Map isMemberExsistMap(Map param) {
|
||||
return selectOne(NAMESPACE + ".isMemberExsistMap", param);
|
||||
}
|
||||
|
||||
public Map isBsnmMemberExsistMap(Map param) {
|
||||
return selectOne(NAMESPACE + ".isBsnmMemberExsistMap", param);
|
||||
}
|
||||
|
||||
public Map isMemberIdMap(String mberId) {
|
||||
return selectOne(NAMESPACE + ".isMemberIdMap", mberId);
|
||||
}
|
||||
|
||||
public Map isMemberNoMap(String mberNo) {
|
||||
return selectOne(NAMESPACE + ".isMemberNoMap", mberNo);
|
||||
}
|
||||
|
||||
public int updatePwd(Map param) {
|
||||
return update(NAMESPACE + ".updatePwd", param);
|
||||
}
|
||||
|
||||
public int updateNewPwd(Map param) {
|
||||
return update(NAMESPACE + ".updateNewPwd", param);
|
||||
}
|
||||
|
||||
public Map checkSecsnAt(Map defInfo) {
|
||||
return selectOne(NAMESPACE + ".checkSecsnAt", defInfo);
|
||||
}
|
||||
|
||||
public void insertConnInfo(HashMap param) {
|
||||
insert(NAMESPACE + ".insertConnInfo", param);
|
||||
}
|
||||
|
||||
public int chkExsistActNo(Map param) {
|
||||
return selectOne(NAMESPACE + ".chkExsistActNo", param);
|
||||
}
|
||||
|
||||
public int saveMnychRdcxptInfo(Map param) {
|
||||
return insert(NAMESPACE + ".saveMnychRdcxptInfo", param);
|
||||
}
|
||||
|
||||
public int saveNationMrtrsInfo(Map param) {
|
||||
return insert(NAMESPACE + ".saveNationMrtrsInfo", param);
|
||||
}
|
||||
|
||||
public int updateSetleAgreAt(Map param) {
|
||||
return update(NAMESPACE + ".updateSetleAgreAt", param);
|
||||
}
|
||||
|
||||
public int updateFixPwd(Map param) {
|
||||
return update(NAMESPACE + ".updateFixPwd", param);
|
||||
}
|
||||
|
||||
public void updateMemberLoginErrCount(Map param) {
|
||||
update(NAMESPACE + ".updateMemberLoginErrCount", param);
|
||||
}
|
||||
|
||||
public void insertPromptErrorConnInfo(Map errLogKey) {
|
||||
update(NAMESPACE + ".insertPromptErrorConnInfo", errLogKey);
|
||||
}
|
||||
|
||||
public int selectDisuseMemberInfo(String param) {
|
||||
return selectOne(NAMESPACE + ".selectDisuseMemberInfo", param);
|
||||
}
|
||||
|
||||
public Map selectBackupMemberInfo(String param) {
|
||||
return selectOne(NAMESPACE + ".selectBackupMemberInfo", param);
|
||||
}
|
||||
|
||||
public int memberInfoUpdt(Map param) {
|
||||
return update(NAMESPACE + ".memberInfoUpdt", param);
|
||||
}
|
||||
|
||||
public int agreAtUpdt(Map param) {
|
||||
return update(NAMESPACE + ".agreAtUpdt", param);
|
||||
}
|
||||
|
||||
public int backupMberUpdt(String param) {
|
||||
return update(NAMESPACE + ".backupMberUpdt", param);
|
||||
}
|
||||
|
||||
public int disuseMemberUpdt(String param) {
|
||||
return update(NAMESPACE + ".disuseMemberUpdt", param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,277 @@
|
||||
package gtpa.brs.login.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import gtpa.brs.login.service.LoginService;
|
||||
import gtpa.brs.join.service.impl.JoinMapper;
|
||||
import gtpa.brs.login.service.impl.LoginMapper;
|
||||
import gtpa.brs.mypage.web.MypageController;
|
||||
import gtpa.brs.user.dto.UserInfo;
|
||||
import gtpa.brs.util.SHA256Util;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@SuppressFBWarnings
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@Resource(name = "loginDao")
|
||||
private LoginMapper loginMapper;
|
||||
|
||||
@Resource(name = "joinDao")
|
||||
private JoinMapper joinMapper;
|
||||
|
||||
@Autowired
|
||||
private UserInfo userInfo;
|
||||
|
||||
//@Value("${system.admin.id}")
|
||||
private String adminId = "admin";
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(MypageController.class);
|
||||
|
||||
/**
|
||||
* 사용자 정보 조회 (로그인 체크용도로 사용 )
|
||||
*/
|
||||
@Override
|
||||
public Map selectMemberInfoForLogin(Map param) {
|
||||
Map memberMap = loginMapper.selectMemberInfoForLogin(param);
|
||||
|
||||
// 사용자가 존재하지 않을 경우
|
||||
if (memberMap == null) {
|
||||
memberMap = new HashMap();
|
||||
memberMap.put("LOGIN", "notexist");
|
||||
|
||||
// 사용자가 존재할 경우
|
||||
} else {
|
||||
String PASSWORD = (String) memberMap.get("PW");
|
||||
String reqPASSWORD = (String) param.get("pw");
|
||||
reqPASSWORD = SHA256Util.encryptSHA256(reqPASSWORD);
|
||||
logger.info("reqPASSWORD2 : " + reqPASSWORD);
|
||||
logger.info("PASSWORD2 : " + PASSWORD);
|
||||
int promptLogin = Integer.parseInt(String.valueOf(memberMap.get("CONECT_FAILR_CO")));
|
||||
int pwChange = Integer.parseInt(String.valueOf(memberMap.get("PASSWORD_CHANGE_DAY")));
|
||||
if( promptLogin > 4) {
|
||||
memberMap.put("LOGIN", "promptover");
|
||||
return memberMap;
|
||||
}
|
||||
// 패스워드 일치
|
||||
if (PASSWORD.equals(reqPASSWORD)) {
|
||||
if(pwChange < 0){ //비밀번호 변경 90일 초과
|
||||
memberMap.put("LOGIN", "pwChange");
|
||||
}else{
|
||||
memberMap.put("PW_CHANGE", pwChange);
|
||||
memberMap.put("PW", "");
|
||||
memberMap.put("LOGIN", "success");
|
||||
}
|
||||
} else { // 패스워드 불일치
|
||||
memberMap.put("LOGIN", "error");
|
||||
promptLogin = promptLogin + 1;
|
||||
memberMap.put("CONECT_FAILR_CO",promptLogin);
|
||||
loginMapper.updateMemberLoginErrCount(memberMap);
|
||||
}
|
||||
}
|
||||
return memberMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 해당 사용자 아이디가 관리자 아이디인지를 검사한다.
|
||||
*/
|
||||
@Override
|
||||
public boolean isAdmin(String userId) {
|
||||
String[] adminIdList = adminId.split(",");
|
||||
|
||||
for (String adminId : adminIdList) {
|
||||
if (adminId.trim().equals(userId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자의 비밀번호를 업데이트한다.
|
||||
*/
|
||||
@Override
|
||||
public int updatePassword(Map param) {
|
||||
return loginMapper.updatePassword(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveMnychRdcxptInfo(Map param) {
|
||||
Map resultMap = userInfo.getUserInfoByBase();
|
||||
String mberNo = (String) resultMap.get("MBER_NO");
|
||||
param.put("mberNo", mberNo);
|
||||
return loginMapper.saveMnychRdcxptInfo(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int saveNationMrtrsInfo(Map param) {
|
||||
Map resultMap = userInfo.getUserInfoByBase();
|
||||
String mberNo = (String) resultMap.get("MBER_NO");
|
||||
param.put("mberNo", mberNo);
|
||||
return loginMapper.saveNationMrtrsInfo(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map isMemberExsistMap(Map param) {
|
||||
return loginMapper.isMemberExsistMap(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map isBsnmMemberExsistMap(Map param) {
|
||||
return loginMapper.isBsnmMemberExsistMap(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map isMemberIdMap(String mberId) {
|
||||
return loginMapper.isMemberIdMap(mberId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map isMemberNoMap(String mberNo) {
|
||||
return loginMapper.isMemberNoMap(mberNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateNewPwd(Map param) {
|
||||
int uCnt = 0;
|
||||
String newPwd = (String) param.get("sNewPwd");
|
||||
logger.info("newPwd ->>" + newPwd);
|
||||
if ("".equals(newPwd) || newPwd == null) {
|
||||
//새로운 비밀번호를 변경하지 않은경우
|
||||
uCnt = loginMapper.updatePwd(param);
|
||||
} else {
|
||||
if((regEx("[^a-zA-Z0-9]", newPwd)) && (regEx("[~!@#$^*()=_.|]", newPwd))) {
|
||||
//새로운 비밀번호를 변경한경우
|
||||
newPwd = SHA256Util.encryptSHA256(newPwd);
|
||||
param.put("sNewPwd", newPwd);
|
||||
uCnt = loginMapper.updateNewPwd(param);
|
||||
} else {
|
||||
uCnt = -1;
|
||||
return uCnt;
|
||||
}
|
||||
}
|
||||
uCnt += loginMapper.updateSetleAgreAt(param);
|
||||
/*Map result = new HashMap();
|
||||
result.put("STATUS", "S");
|
||||
result.put("UCNT", String.valueOf(uCnt));*/
|
||||
return uCnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* 정규식 검사 메소드(문자열이 지정된 패턴과 일치하는지 여부 검사)
|
||||
* @param ptn 패턴
|
||||
* @param str 검사할 문자열
|
||||
* @return true | false
|
||||
*/
|
||||
public static boolean regEx(String ptn, String str){
|
||||
java.util.regex.Pattern p = java.util.regex.Pattern.compile(ptn,java.util.regex.Pattern.CASE_INSENSITIVE | java.util.regex.Pattern.MULTILINE );
|
||||
java.util.regex.Matcher m = p.matcher(str);
|
||||
return m.find();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map checkSecsnAt(Map defInfo) {
|
||||
return loginMapper.checkSecsnAt(defInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertConnInfo(HashMap param) {
|
||||
loginMapper.insertConnInfo(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int chkExsistActNo(Map param) {
|
||||
return loginMapper.chkExsistActNo(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFixPwd(Map param) {
|
||||
int uCnt = 0;
|
||||
String newPwd = (String) param.get("sNewPwd");
|
||||
newPwd = SHA256Util.encryptSHA256(newPwd);
|
||||
param.put("sNewPwd", newPwd);
|
||||
uCnt = loginMapper.updateFixPwd(param);
|
||||
return uCnt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insertPromptErrorConnInfo(Map errLogKey) {
|
||||
loginMapper.insertPromptErrorConnInfo(errLogKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectDisuseMemberInfo(String param) {
|
||||
String result = "";
|
||||
int disuseCnt = loginMapper.selectDisuseMemberInfo(param);
|
||||
if(disuseCnt == 0) {
|
||||
result = "N";
|
||||
} else if(disuseCnt == 1) {
|
||||
result = "Y";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map selectBackupMemberInfo(String param) {
|
||||
Map result = new HashMap<>();
|
||||
result = loginMapper.selectBackupMemberInfo(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String memberInfoUpdt(Map param) {
|
||||
String result = "";
|
||||
int mberUpdtCnt = loginMapper.memberInfoUpdt(param);
|
||||
if(mberUpdtCnt == 0) {
|
||||
result = "F";
|
||||
} else if(mberUpdtCnt == 1) {
|
||||
result = "S";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String agreAtUpdt(Map param) {
|
||||
String result = "";
|
||||
int mberUpdtCnt = loginMapper.agreAtUpdt(param);
|
||||
if(mberUpdtCnt == 0) {
|
||||
result = "F";
|
||||
} else if(mberUpdtCnt == 1) {
|
||||
result = "S";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String backupMberUpdt(String param) {
|
||||
String result = "";
|
||||
int mberUpdtCnt = loginMapper.backupMberUpdt(param);
|
||||
if(mberUpdtCnt == 0) {
|
||||
result = "F";
|
||||
} else if(mberUpdtCnt == 1) {
|
||||
result = "S";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String disuseMemberUpdt(String param) {
|
||||
String result = "";
|
||||
int mberUpdtCnt = loginMapper.disuseMemberUpdt(param);
|
||||
if(mberUpdtCnt == 0) {
|
||||
result = "F";
|
||||
} else if(mberUpdtCnt == 1) {
|
||||
result = "S";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,131 @@
|
||||
package gtpa.brs.mypage.service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public interface MypageService {
|
||||
|
||||
public Map isCheckNowPwdInfo(Map param);
|
||||
|
||||
public String isCheckNowPwdInfoCnt(Map param);
|
||||
|
||||
public int companyInfoUpdate(Map param);
|
||||
|
||||
public List getMyCarinfoList(Map param);
|
||||
|
||||
public Map myCarinfoDeleteList(List params);
|
||||
|
||||
public Map updateCarinfoList(List params);
|
||||
|
||||
public Map updateCarCardinfoList(List params);
|
||||
|
||||
public Map updateDelCarinfoList(List params);
|
||||
|
||||
public String updateNewCarinfoList(List params1, List params2, List params3) throws SQLException;
|
||||
|
||||
public String updateNewBankinfoList(List params1, List params2, List params3, List params4) throws SQLException;
|
||||
|
||||
public List getMyCardInfoList(Map param);
|
||||
|
||||
public Map myCreditDelList(List params);
|
||||
|
||||
public Map registCardInfo(Map param, HttpServletRequest request);
|
||||
|
||||
public Map registTmInfo(Map param, HttpServletRequest request);
|
||||
|
||||
public Map getMyLeaderCarInfo(Map param);
|
||||
|
||||
public List getMyBankInfoList(Map param);
|
||||
|
||||
public String secSnUpdate(Map param);
|
||||
|
||||
public String mySecSnCarinfoDelete(Map param);
|
||||
|
||||
public String mySecSnCardterminatePayment(Map param);
|
||||
|
||||
public String mySecSnBankPayment(Map param);
|
||||
|
||||
public String updateSecSnBankCarInfo(Map params) throws SQLException;
|
||||
|
||||
public Map updateCardinfoList(List params);
|
||||
|
||||
public int updateMnychRdcxptInfo(Map param);
|
||||
|
||||
public int updateMnychRdcxptInfo2(Map param);
|
||||
|
||||
public Map selMnychRdcxptInfo(Map param);
|
||||
|
||||
public int instMnychRdcxptInfo(Map param);
|
||||
|
||||
public int updtMberInfo(Map param);
|
||||
|
||||
public int updateNationMrtrsInfo(Map param);
|
||||
|
||||
//계좌등록 관련 메소드
|
||||
public Map insertMyAcnutPblLog(Map param);
|
||||
|
||||
public Map insertMyAcnutPblInfoHist(Map param);
|
||||
|
||||
public Map updateMyAcnutPblLog(Map param);
|
||||
|
||||
public String updateBankinfoList(List params);
|
||||
|
||||
public String deleteBankinfoList(List params);
|
||||
|
||||
public String getMyAcctNo(Map params);
|
||||
|
||||
// 녹새교통 현황 - 메인
|
||||
public Map getFeeCnt(Map param);
|
||||
|
||||
public ArrayList<Map<String, String>> getParkingFeeCnt(Map param);
|
||||
|
||||
public Map getPenaltyCnt(Map param);
|
||||
|
||||
public Map getFeeStateCnt(Map param);
|
||||
|
||||
public Map getCvplRceptCnt(Map param);
|
||||
|
||||
public Map getPenaltyStateCnt(Map param);
|
||||
|
||||
public Map getPenaltySubCnt(Map param);
|
||||
|
||||
public Map getPenaltyDecisionCnt(Map param);
|
||||
|
||||
public Map getRefndCnt(Map param);
|
||||
|
||||
public Map vhcleConfirm(Map params);
|
||||
|
||||
// 다자녀 감면정보 및 국가공유자 및 거주지 조회
|
||||
public Map getRdcxptInfoAllChldrn(Map myInfo);
|
||||
|
||||
public Map getMnychRdcxpt(Map dbParam);
|
||||
|
||||
public Map getRdcxptInfoNtttn(Map myInfo);
|
||||
|
||||
public Map getResideInsttCnfirm(Map myInfo);
|
||||
|
||||
public List getMyInfo(Map param);
|
||||
|
||||
public int updateMberSttus(String param);
|
||||
|
||||
public int updateVhcleSttus(String param);
|
||||
|
||||
public int deleteMberVhcle(Map param);
|
||||
|
||||
public List mberData(String param);
|
||||
|
||||
public String getMberInfoCi();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,212 @@
|
||||
package gtpa.brs.mypage.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
|
||||
@Repository("MypageDAO")
|
||||
public class MypageMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "MypageDAO";
|
||||
|
||||
public Map isCheckNowPwdInfo(Map param) {
|
||||
return selectOne(NAMESPACE + ".isCheckNowPwdInfo", param);
|
||||
}
|
||||
|
||||
public String isCheckNowPwdInfoCnt(Map param) {
|
||||
return selectOne(NAMESPACE + ".isCheckNowPwdInfoCnt", param);
|
||||
}
|
||||
|
||||
public int companyNoPwdInfoUpdate(Map param) {
|
||||
return update(NAMESPACE + ".companyNoPwdInfoUpdate", param);
|
||||
}
|
||||
|
||||
public int companyInfoUpdate(Map param) {
|
||||
return update(NAMESPACE + ".companyInfoUpdate", param);
|
||||
}
|
||||
|
||||
public int secSnUpdate(Map param) {
|
||||
return update(NAMESPACE + ".secSnUpdate", param);
|
||||
}
|
||||
|
||||
//차량등록정보
|
||||
public List getMyCarinfoList(Map param) {
|
||||
return selectList(NAMESPACE + ".getMyCarinfoList", param);
|
||||
}
|
||||
|
||||
//나의 탈퇴처리 차량정보 조회
|
||||
public List<Map> getMySecSnCarinfoList(String mberNo) {
|
||||
List<Map> resultList = new ArrayList();
|
||||
resultList = selectList(NAMESPACE + ".getMySecSnCarinfoList", mberNo);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
//나의 자동차 해지카드정보 조회
|
||||
public Map getMyCarCardDelInfo(Map param) {
|
||||
return selectOne(NAMESPACE + ".getMyCarCardDelInfo", param);
|
||||
}
|
||||
|
||||
public int myCarinfoDeleteList(String tmpData) {
|
||||
return delete(NAMESPACE + ".myCarinfoDeleteList", tmpData);
|
||||
}
|
||||
|
||||
public int myCarinfoUpdateList(String vhcleManageNo) {
|
||||
return update(NAMESPACE + ".myCarinfoUpdateList", vhcleManageNo);
|
||||
}
|
||||
|
||||
public int insertMyCarInfos(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyCarInfos", param);
|
||||
}
|
||||
|
||||
public int insertMyCarInfosHistory(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyCarInfosHistory", param);
|
||||
}
|
||||
|
||||
public int myCarinfoModifiedList(Map param) {
|
||||
return insert(NAMESPACE + ".myCarinfoModifiedList", param);
|
||||
}
|
||||
|
||||
// 나의 계좌정보 등록 Start
|
||||
public int insertMyAcnutPblLog(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblLog", param);
|
||||
}
|
||||
|
||||
public int insertMyAcnutPblInfo(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblInfo", param);
|
||||
}
|
||||
|
||||
public int insertMyAcnutPblInfoHist(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblInfoHist", param);
|
||||
}
|
||||
|
||||
public int insertMyAcnutPblInfoHistC(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblInfoHistC", param);
|
||||
}
|
||||
|
||||
public int insertMyAcnutPblInfoHistU(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblInfoHistU", param);
|
||||
}
|
||||
|
||||
public int insertMyAcnutPblInfoHistD(Map param) {
|
||||
return insert(NAMESPACE + ".insertMyAcnutPblInfoHistD", param);
|
||||
}
|
||||
|
||||
public int updateMyAcnutPblLog(Map param) {
|
||||
return update(NAMESPACE + ".updateMyAcnutPblLog", param);
|
||||
}
|
||||
|
||||
public int updateMyAcnutPblInfo(Map param) {
|
||||
return update(NAMESPACE + ".updateMyAcnutPblInfo", param);
|
||||
}
|
||||
|
||||
public int deleteMyAcnutPblInfo(Map param) {
|
||||
return update(NAMESPACE + ".deleteMyAcnutPblInfo", param);
|
||||
}
|
||||
|
||||
// 나의 계좌정보 등록 End
|
||||
|
||||
public Map selMnychRdcxptInfo(Map param) {
|
||||
return selectOne(NAMESPACE + ".selMnychRdcxptInfo", param);
|
||||
}
|
||||
|
||||
public int updateMnychRdcxptInfo(Map param) {
|
||||
return update(NAMESPACE + ".updateMnychRdcxptInfo", param);
|
||||
}
|
||||
|
||||
public int updateMnychRdcxptInfo2(Map param) {
|
||||
return update(NAMESPACE + ".updateMnychRdcxptInfo2", param);
|
||||
}
|
||||
|
||||
public int instMnychRdcxptInfo(Map param) {
|
||||
return insert(NAMESPACE + ".instMnychRdcxptInfo", param);
|
||||
}
|
||||
|
||||
public int delMnychVhcle(Map param) {
|
||||
return update(NAMESPACE + ".delMnychVhcle", param);
|
||||
}
|
||||
|
||||
public int updateNationMrtrsInfo(Map param) {
|
||||
return update(NAMESPACE + ".updateNationMrtrsInfo", param);
|
||||
}
|
||||
|
||||
public int updtMberInfo(Map param) {
|
||||
return update(NAMESPACE + ".updtMberInfo", param);
|
||||
}
|
||||
|
||||
//카드정보
|
||||
public List getMyCardInfoList(Map param) {
|
||||
return selectList(NAMESPACE + ".getMyCardInfoList", param);
|
||||
}
|
||||
|
||||
//계좌정보
|
||||
public List getMyBankInfoList(Map param) {
|
||||
return selectList(NAMESPACE + ".getMyBankInfoList", param);
|
||||
}
|
||||
|
||||
// 나의 대표차량정보 정보
|
||||
public Map getMyLeaderCarInfo(Map param) {
|
||||
return selectOne(NAMESPACE + ".getMyLeaderCarInfo", param);
|
||||
}
|
||||
|
||||
// 나의 대표차량정보 목록 정보
|
||||
public List getMyLeaderCarInfoList(Map param) {
|
||||
return selectList(NAMESPACE + ".getMyLeaderCarInfoList", param);
|
||||
}
|
||||
|
||||
//이용료 - 환불 현황
|
||||
public Map getRefndCnt(Map param) {
|
||||
return selectOne(NAMESPACE + ".getRefndCntList", param);
|
||||
}
|
||||
|
||||
// 나의 등록된 쿠콘계좌정보에 주민번호 조회
|
||||
public String getMyAcctNo(Map param) {
|
||||
return selectOne(NAMESPACE + ".getMyAcctNo", param);
|
||||
}
|
||||
|
||||
public int updateSetleAgreAt(Map param) {
|
||||
return update(NAMESPACE + ".updateSetleAgreAt", param);
|
||||
}
|
||||
|
||||
public List getMyInfo(Map param) {
|
||||
return selectList(NAMESPACE + ".getMyInfo", param);
|
||||
}
|
||||
|
||||
public int updateMberSttus(String param) {
|
||||
return update(NAMESPACE + ".updateMberSttus", param);
|
||||
}
|
||||
|
||||
public int updateVhcleSttus(String param) {
|
||||
return update(NAMESPACE + ".updateVhcleSttus", param);
|
||||
}
|
||||
|
||||
public int deleteMberVhcle(Map param) {
|
||||
return delete(NAMESPACE + ".deleteMberVhcle", param);
|
||||
}
|
||||
|
||||
public List mberData(String param) {
|
||||
return selectList(NAMESPACE + ".mberData", param);
|
||||
}
|
||||
|
||||
public Map getMnychRdcxpt(Map param) {
|
||||
return selectOne(NAMESPACE + ".getMnychRdcxpt", param);
|
||||
}
|
||||
|
||||
public String getMberInfoCi(Map mberinfo) {
|
||||
return selectOne(NAMESPACE + ".getMberInfoCi", mberinfo);
|
||||
}
|
||||
|
||||
public Map vhcleConfirm(Map params) {
|
||||
return selectOne(NAMESPACE + ".vhcleConfirm", params);
|
||||
}
|
||||
|
||||
public int insertResideLog(Map params) {
|
||||
return insert(NAMESPACE + ".insertResideLog", params);
|
||||
}
|
||||
|
||||
public int insertRdcxptLog(Map params) {
|
||||
return insert(NAMESPACE + ".insertRdcxptLog", params);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,85 @@
|
||||
package gtpa.brs.payment.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository("preRegistPaymentDao")
|
||||
public class PreRegistPaymentMapper extends EgovAbstractMapper {
|
||||
|
||||
private String NAMESPACE = "PreRegistPaymentDAO";
|
||||
|
||||
public String getTranSerialNo() {
|
||||
String tranSerialNo = "";
|
||||
try {
|
||||
tranSerialNo = padLeftZero(selectOne(NAMESPACE + ".getTranSerialNo"), 8);
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
tranSerialNo = padLeftZero("1", 8);
|
||||
}
|
||||
return tranSerialNo;
|
||||
}
|
||||
|
||||
private String padLeftZero(String inputString, int length) {
|
||||
if (inputString.length() >= length) {
|
||||
return inputString;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (sb.length() < length - inputString.length()) {
|
||||
sb.append('0');
|
||||
}
|
||||
sb.append(inputString);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public List<Map> getPaymentMngCd() {
|
||||
return selectList(NAMESPACE + ".getPaymentMngCd");
|
||||
}
|
||||
|
||||
public List<Map> getPaymentCd(Map params) {
|
||||
return selectList(NAMESPACE + ".getPaymentCd", params);
|
||||
}
|
||||
|
||||
public Map getPaymentInfo(String userNo) {
|
||||
return selectOne(NAMESPACE + ".getPaymentInfo", userNo);
|
||||
}
|
||||
|
||||
public String getTrscSeqNo() {
|
||||
String tranSerialNo = "";
|
||||
Date date = new Date();
|
||||
int day = date.getDay();
|
||||
try {
|
||||
tranSerialNo = padLeftZero(selectOne(NAMESPACE + ".getTrscSeqNo"), 6);
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
tranSerialNo = padLeftZero("1", 6);
|
||||
} finally {
|
||||
tranSerialNo = day + "" + tranSerialNo;
|
||||
}
|
||||
return tranSerialNo;
|
||||
}
|
||||
|
||||
public List<Map> getBankCd(Map params) {
|
||||
return selectList(NAMESPACE + ".getBankCd", params);
|
||||
}
|
||||
|
||||
public void insertAcctHist(Map acctHistData) {
|
||||
insert(NAMESPACE + ".insertAcctHist", acctHistData);
|
||||
}
|
||||
|
||||
public int insertAcctInfoComplete(List acctHistData) {
|
||||
int rsltCnt = 0;
|
||||
rsltCnt += insert(NAMESPACE + ".insertAcctInfoComplete", acctHistData);
|
||||
rsltCnt += insert(NAMESPACE + ".insertAcctInfoCompleteHist", acctHistData);
|
||||
return rsltCnt;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package gtpa.brs.penalty.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 17/05/2019
|
||||
* TIME : 5:26 PM
|
||||
* Project : BRSPW
|
||||
* Class : PenaltyService
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public interface PenaltyService {
|
||||
|
||||
Map getFfnlgInfo(Map param);
|
||||
|
||||
Map getFfnlgInfoDetail(Map param);
|
||||
|
||||
Map getFfnlgInfoByFee(Map param);
|
||||
|
||||
Map getFfnlgInfoDetailByFee(Map param);
|
||||
|
||||
Map payAPenalty(Map<String, Object> param);
|
||||
|
||||
|
||||
Map getPenaltyCivilAcceptList(Map param);
|
||||
|
||||
Map getPenaltyCivilAcceptDetail(Map param);
|
||||
|
||||
Map penaltyCivilAcceptInsert(Map<String, Object> param1, Map<String, Object> param2, List files);
|
||||
|
||||
Map penaltyCivilAcceptUpdate(Map<String, Object> param1, Map<String, Object> param2, List files);
|
||||
|
||||
Map getPenaltyByFeeCivilAcceptList(Map param);
|
||||
|
||||
Map getPenaltyByFeeCivilAcceptDetail(Map param);
|
||||
|
||||
Map penaltyByFeeCivilAcceptInsert(Map<String, Object> param1, Map<String, Object> param2, List files);
|
||||
|
||||
Map penaltyByFeeCivilAcceptUpdate(Map<String, Object> param1, Map<String, Object> param2, List files);
|
||||
|
||||
Map opinionPrivachCheckApi(Map<String, Object> param, List files);
|
||||
|
||||
Map problemPrivachCheckApi(Map<String, Object> param);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package gtpa.brs.penalty.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 27/05/2019
|
||||
* TIME : 11:17 AM
|
||||
* Project : BRSPW
|
||||
* Class : PenaltyMapper
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Repository("penaltyDao")
|
||||
public class PenaltyMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "PenaltyDAO";
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,60 @@
|
||||
package gtpa.brs.scheduler;
|
||||
|
||||
import gtpa.brs.scheduler.service.HealthCheckService;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.net.InetAddress;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@SuppressFBWarnings
|
||||
@Service
|
||||
public class HelthCheckScheduler {
|
||||
private Logger logger = LoggerFactory.getLogger(HelthCheckScheduler.class);
|
||||
|
||||
@Autowired
|
||||
HealthCheckService healthCheckService;
|
||||
|
||||
@Resource(name = "globalsProperties")
|
||||
private Properties env;
|
||||
|
||||
@Async
|
||||
@Scheduled(cron = "0 0/4 * * * *")
|
||||
public void healthCheck() {
|
||||
try {
|
||||
Map param = new HashMap();
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
|
||||
param.put("COLCT_DT", now);
|
||||
String hostname = InetAddress.getLocalHost().getHostName();
|
||||
String colctId = "";
|
||||
if (env.getProperty("Globals.Was1.Hostname") != null && env.getProperty("Globals.Was1.Hostname").equals(hostname)) {
|
||||
colctId = "14";
|
||||
} else if (env.getProperty("Globals.Was2.Hostname") != null && env.getProperty("Globals.Was2.Hostname").equals(hostname)) {
|
||||
colctId = "15";
|
||||
}
|
||||
param.put("COLCT_ID", colctId);
|
||||
if (!colctId.equals("")) {
|
||||
healthCheckService.insertStatus(param);
|
||||
logger.info("helthCheckScheduler ::::" + now);
|
||||
} else {
|
||||
logger.info("helthCheckScheduler error ::::" + now + "::" + colctId);
|
||||
}
|
||||
logger.info(InetAddress.getLocalHost().getHostName());
|
||||
logger.info(InetAddress.getLocalHost().getHostAddress());
|
||||
} catch (RuntimeException re) {
|
||||
logger.error("[RuntimeException::" + "" + "]", re);
|
||||
} catch (Exception e) {
|
||||
logger.error("[process error::" + "" + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package gtpa.brs.scheduler.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface HealthCheckService {
|
||||
void insertStatus(Map param);
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package gtpa.brs.scheduler.service.impl;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.EgovAbstractMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Repository("healthCheckDao")
|
||||
public class HealthCheckMapper extends EgovAbstractMapper {
|
||||
private String NAMESPACE = "HealthCheckDAO";
|
||||
|
||||
public void insertStatus(Map param) {
|
||||
insert(NAMESPACE + ".insertStatus", param);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package gtpa.brs.scheduler.service.impl;
|
||||
|
||||
import gtpa.brs.scheduler.service.HealthCheckService;
|
||||
import gtpa.brs.scheduler.service.impl.HealthCheckMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class HealthCheckServiceImpl implements HealthCheckService {
|
||||
|
||||
@Resource(name = "healthCheckDao")
|
||||
HealthCheckMapper healthCheckMapper;
|
||||
|
||||
@Override
|
||||
public void insertStatus(Map param) {
|
||||
healthCheckMapper.insertStatus(param);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,700 @@
|
||||
package gtpa.brs.security;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 18/06/2019
|
||||
* TIME : 10:21 AM
|
||||
* Project : BRSPW
|
||||
* Class : CACHECK
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
import com.sun.crypto.provider.SunJCE;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.ConnectException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.URL;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.Security;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
@SuppressFBWarnings
|
||||
public class CACHECK {
|
||||
final int PROC_OK = 0;
|
||||
final int PROCESS_ERR = -1;
|
||||
final int ENC_PROC_ERR = -2;
|
||||
final int ENC_DATA_ERR = -3;
|
||||
final int DEC_PROC_ERR = -4;
|
||||
final int DEC_HASH_ERR = -5;
|
||||
final int DEC_DATA_ERR = -6;
|
||||
final int CIPHER_VERSION_MISMATCH = -7;
|
||||
final int CIPHER_VERSION_ERR = -8;
|
||||
final int INPUT_DATA_ERR = -9;
|
||||
final int PWD_MISMATCH_ERR = -12;
|
||||
final int RECV_DATA_ERR = -18;
|
||||
final int SVR_CONN_ERR = -18;
|
||||
static final short CIPHER_HEADER_LEN = 3;
|
||||
static final short CIPHER_DATETIME_LEN = 13;
|
||||
static final short CIPHER_IPADDRESS_LEN = 16;
|
||||
static final short AES128_CIPHER_KEYLEN = 16;
|
||||
static final short SHA256_DIGEST_VALUELEN = 32;
|
||||
static final short SECRET_KEY_CIPHER_LEN = 48;
|
||||
static final byte CRYPT_VERSION_MAJOR = 2;
|
||||
static final byte CRYPT_VERSION_MINOR = 0;
|
||||
final int LEN_REQUEST_TYPE = 1;
|
||||
final int LEN_SNUMBER = 10;
|
||||
final int LEN_BNUMBER = 13;
|
||||
final int LEN_COMPNAME_MAX = 40;
|
||||
final int LEN_REPNAME_MAX = 40;
|
||||
final String AUTH_SERVER_ADDR = "https://oksign.seoul.go.kr/cacheck.asp";
|
||||
final int AUTH_SERVER_PORT = 81;
|
||||
static final short AUTH_RETURN_DATA_CNT = 4;
|
||||
private String m_strPlainData = "";
|
||||
private String m_strCipherData = "";
|
||||
private String m_strCipherDateTime = "";
|
||||
private String m_strCipherIPAddress = "";
|
||||
private String m_strReturnCode = "";
|
||||
private String m_strReturnCompName = "";
|
||||
private String m_strReturnRepName = "";
|
||||
private String m_strStatusCode = "";
|
||||
private static byte[] mBase64EncMap;
|
||||
private static byte[] mBase64DecMap;
|
||||
|
||||
public CACHECK() {
|
||||
Security.addProvider(new SunJCE());
|
||||
}
|
||||
|
||||
private String base64Encode(byte[] var1) throws Exception {
|
||||
if (var1 != null && var1.length != 0) {
|
||||
byte[] var2 = new byte[(var1.length + 2) / 3 * 4];
|
||||
int var3 = 0;
|
||||
|
||||
int var4;
|
||||
for(var4 = 0; var3 < var1.length - 2; var3 += 3) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] >>> 2 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] >>> 4 & 15 | var1[var3] << 4 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 2] >>> 6 & 3 | var1[var3 + 1] << 2 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 2] & 63];
|
||||
}
|
||||
|
||||
if (var3 < var1.length) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] >>> 2 & 63];
|
||||
if (var3 < var1.length - 1) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] >>> 4 & 15 | var1[var3] << 4 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] << 2 & 63];
|
||||
} else {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] << 4 & 63];
|
||||
}
|
||||
}
|
||||
|
||||
while(var4 < var2.length) {
|
||||
var2[var4] = 61;
|
||||
++var4;
|
||||
}
|
||||
|
||||
String var5 = new String(var2, "euc-kr");
|
||||
return var5;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can not encode NULL or empty byte array.");
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] base64Decode(String var1) throws Exception {
|
||||
if (var1 != null && var1.length() != 0) {
|
||||
byte[] var2 = var1.getBytes("euc-kr");
|
||||
|
||||
int var3;
|
||||
for(var3 = var2.length; var2[var3 - 1] == 61; --var3) {
|
||||
;
|
||||
}
|
||||
|
||||
byte[] var4 = new byte[var3 - var2.length / 4];
|
||||
|
||||
int var5;
|
||||
for(var5 = 0; var5 < var2.length; ++var5) {
|
||||
var2[var5] = mBase64DecMap[var2[var5]];
|
||||
}
|
||||
|
||||
var5 = 0;
|
||||
|
||||
int var6;
|
||||
for(var6 = 0; var6 < var4.length - 2; var6 += 3) {
|
||||
var4[var6] = (byte)(var2[var5] << 2 & 255 | var2[var5 + 1] >>> 4 & 3);
|
||||
var4[var6 + 1] = (byte)(var2[var5 + 1] << 4 & 255 | var2[var5 + 2] >>> 2 & 15);
|
||||
var4[var6 + 2] = (byte)(var2[var5 + 2] << 6 & 255 | var2[var5 + 3] & 63);
|
||||
var5 += 4;
|
||||
}
|
||||
|
||||
if (var6 < var4.length) {
|
||||
var4[var6] = (byte)(var2[var5] << 2 & 255 | var2[var5 + 1] >>> 4 & 3);
|
||||
}
|
||||
|
||||
++var6;
|
||||
if (var6 < var4.length) {
|
||||
var4[var6] = (byte)(var2[var5 + 1] << 4 & 255 | var2[var5 + 2] >>> 2 & 15);
|
||||
}
|
||||
|
||||
return var4;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can not decode NULL or empty string.");
|
||||
}
|
||||
}
|
||||
|
||||
public String getReturnCode() {
|
||||
return this.m_strReturnCode;
|
||||
}
|
||||
|
||||
public String getReturnCompName() {
|
||||
return this.m_strReturnCompName;
|
||||
}
|
||||
|
||||
public String getReturnRepName() {
|
||||
return this.m_strReturnRepName;
|
||||
}
|
||||
|
||||
public String getStatusCode() {
|
||||
return this.m_strStatusCode;
|
||||
}
|
||||
|
||||
public int fnRequest(String var1, String var2, String var3, String var4, String var5, String var6, String var7) {
|
||||
if (var1.length() > 20) {
|
||||
return -9;
|
||||
} else if (var2.length() > 127) {
|
||||
return -9;
|
||||
} else if (var3.length() != 1) {
|
||||
return -9;
|
||||
} else if (var4.length() > 10) {
|
||||
return -9;
|
||||
} else if (var5.length() > 13) {
|
||||
return -9;
|
||||
} else if (var6.length() > 40) {
|
||||
return -9;
|
||||
} else if (var7.length() > 40) {
|
||||
return -9;
|
||||
} else {
|
||||
boolean var8 = false;
|
||||
int var9 = Math.abs((new Long(System.currentTimeMillis())).intValue());
|
||||
int var10 = 81 + var9 % 5;
|
||||
StringBuffer var11 = new StringBuffer();
|
||||
this.m_strPlainData = "";
|
||||
this.m_strCipherData = "";
|
||||
this.m_strReturnCode = "";
|
||||
this.m_strReturnCompName = "";
|
||||
this.m_strReturnRepName = "";
|
||||
this.m_strStatusCode = "";
|
||||
|
||||
try {
|
||||
var11.append(var1);
|
||||
var11.append("|");
|
||||
var11.append(var2);
|
||||
var11.append("|");
|
||||
var11.append(var3);
|
||||
var11.append("|");
|
||||
var11.append(var4);
|
||||
var11.append("|");
|
||||
var11.append(var5);
|
||||
var11.append("|");
|
||||
var11.append(var6);
|
||||
var11.append("|");
|
||||
var11.append(var7);
|
||||
int var27 = this.fnEncode(var1, var2, var11.toString());
|
||||
if (var27 == 0) {
|
||||
String var12 = "";
|
||||
var11.delete(0, var11.capacity());
|
||||
//URL var13 = new URL("http://121.162.155.81/cacheck.asp");
|
||||
URL var13 = new URL("http://175.193.201.51/cacheck.asp");
|
||||
String var14 = var13.getHost();
|
||||
String var15 = var13.getFile();
|
||||
Socket var16 = new Socket();
|
||||
var16.connect(new InetSocketAddress(var14, 80), 5000);
|
||||
var16.setSoTimeout(5000);
|
||||
PrintWriter var17 = new PrintWriter(var16.getOutputStream(), false);
|
||||
InputStream var18 = var16.getInputStream();
|
||||
var11.append("POST " + var15 + " HTTP/1.1\n");
|
||||
var11.append("Accept: */*\n");
|
||||
var11.append("Content-Type: application/x-www-form-urlencoded\n");
|
||||
var11.append("Host: " + var14 + ":" + var10 + "\n");
|
||||
var11.append("Content-Length: " + (this.m_strCipherData.length() + 9) + "\n");
|
||||
var11.append("Connection: close\n");
|
||||
var11.append("Cache-Control: no-cache\r\n\r\n");
|
||||
var11.append("enc_data=");
|
||||
var11.append(this.m_strCipherData);
|
||||
var17.print(var11.toString());
|
||||
var17.flush();
|
||||
byte[] var19 = new byte[1024];
|
||||
var18.read(var19);
|
||||
String var20 = new String(var19);
|
||||
String var21 = "";
|
||||
int var22 = var20.indexOf("\r\n\r\n");
|
||||
if (var22 > 0) {
|
||||
var21 = var20.substring(var22 + 4).trim();
|
||||
} else if (var22 < 0 && var20.indexOf("100 Continue") > 0) {
|
||||
var17.print(var11.toString());
|
||||
var17.flush();
|
||||
var18.read(var19);
|
||||
var20 = new String(var19);
|
||||
var22 = var20.indexOf("\r\n\r\n");
|
||||
if (var22 > 0) {
|
||||
var21 = var20.substring(var22 + 4).trim();
|
||||
} else {
|
||||
var27 = -18;
|
||||
}
|
||||
} else {
|
||||
var27 = -18;
|
||||
}
|
||||
|
||||
var11.setLength(0);
|
||||
var17.close();
|
||||
var18.close();
|
||||
var16.close();
|
||||
var16 = null;
|
||||
var18 = null;
|
||||
var17 = null;
|
||||
if (var27 == 0) {
|
||||
var27 = this.fnDecode(var1, var2, var21);
|
||||
if (var27 == 0) {
|
||||
String[] var23 = null;
|
||||
var23 = this.m_strPlainData.split("\\|", 4);
|
||||
if (var23.length < 4) {
|
||||
var27 = -18;
|
||||
} else {
|
||||
this.m_strReturnCode = var23[0];
|
||||
this.m_strStatusCode = var23[1];
|
||||
this.m_strReturnCompName = var23[2];
|
||||
this.m_strReturnRepName = var23[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return var27;
|
||||
} catch (ConnectException var24) {
|
||||
return -18;
|
||||
} catch (SocketException var25) {
|
||||
return -18;
|
||||
} catch (Exception var26) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int fnEncode(String var1, String var2, String var3) {
|
||||
this.m_strCipherData = "";
|
||||
if (var1.trim().length() != 0 && var1.trim().length() <= 127 && var2.trim().length() != 0) {
|
||||
byte var4 = 0;
|
||||
boolean var5 = false;
|
||||
boolean var6 = false;
|
||||
boolean var7 = false;
|
||||
byte var8 = 0;
|
||||
boolean var9 = false;
|
||||
Object var10 = null;
|
||||
Object var11 = null;
|
||||
Object var12 = null;
|
||||
Object var13 = null;
|
||||
Object var14 = null;
|
||||
Object var15 = null;
|
||||
Object var16 = null;
|
||||
Object var17 = null;
|
||||
Object var18 = null;
|
||||
Object var19 = null;
|
||||
Object var20 = null;
|
||||
Object var21 = null;
|
||||
Object var22 = null;
|
||||
Date var23 = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat var24 = new SimpleDateFormat("yyMMddHHmmss");
|
||||
String var25 = var24.format(var23);
|
||||
String var26 = var1.trim();
|
||||
String var27 = var2.trim();
|
||||
StringBuffer var28 = new StringBuffer();
|
||||
|
||||
try {
|
||||
byte[] var37 = var26.getBytes();
|
||||
int var33 = var37.length;
|
||||
byte[] var36 = new byte[]{2, 0, (new Integer(var33)).byteValue()};
|
||||
int var34 = var8 + 3;
|
||||
var34 += var33;
|
||||
var28.append(var25);
|
||||
var28.append("^");
|
||||
var28.append(getLocalIPAddr());
|
||||
var28.append("^");
|
||||
var28.append(var3);
|
||||
byte[] var39 = getHashValue(var28.toString());
|
||||
var34 += 32;
|
||||
byte[] var38 = getHashValue(var26 + var27);
|
||||
var34 += 32;
|
||||
byte[] var40 = getHashValue(var27);
|
||||
byte[] var41 = new byte[16];
|
||||
byte[] var42 = new byte[16];
|
||||
|
||||
int var31;
|
||||
for(var31 = 0; var31 < 16; ++var31) {
|
||||
var41[var31] = var40[var31];
|
||||
var42[var31] = var40[16 + var31];
|
||||
}
|
||||
|
||||
byte[] var44 = getHashValue((new Integer(getRandomValue())).toString());
|
||||
byte[] var43 = getEncodeValue(var41, var42, var44);
|
||||
if (var43 != null) {
|
||||
var34 += 48;
|
||||
byte[] var45 = new byte[16];
|
||||
byte[] var46 = new byte[16];
|
||||
|
||||
for(var31 = 0; var31 < 16; ++var31) {
|
||||
var45[var31] = var44[var31];
|
||||
var46[var31] = var44[16 + var31];
|
||||
}
|
||||
|
||||
byte[] var47 = getEncodeValue(var45, var46, var28.toString().getBytes("euc-kr"));
|
||||
if (var47 != null) {
|
||||
int var35 = var47.length;
|
||||
var34 += var35;
|
||||
byte[] var48 = new byte[var34];
|
||||
int var32 = 0;
|
||||
|
||||
for(var31 = 0; var31 < 3; ++var31) {
|
||||
var48[var32] = var36[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
for(var31 = 0; var31 < var33; ++var31) {
|
||||
var48[var32] = var37[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
for(var31 = 0; var31 < 32; ++var31) {
|
||||
var48[var32] = var39[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
for(var31 = 0; var31 < 32; ++var31) {
|
||||
var48[var32] = var38[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
for(var31 = 0; var31 < 48; ++var31) {
|
||||
var48[var32] = var43[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
for(var31 = 0; var31 < var35; ++var31) {
|
||||
var48[var32] = var47[var31];
|
||||
++var32;
|
||||
}
|
||||
|
||||
this.m_strCipherData = this.base64Encode(var48);
|
||||
} else {
|
||||
var4 = -2;
|
||||
}
|
||||
} else {
|
||||
var4 = -2;
|
||||
}
|
||||
} catch (IOException var30) {
|
||||
var4 = -2;
|
||||
} catch (Exception var30) {
|
||||
var4 = -2;
|
||||
}
|
||||
|
||||
return var4;
|
||||
} else {
|
||||
return -9;
|
||||
}
|
||||
}
|
||||
|
||||
private int fnDecode(String var1, String var2, String var3) {
|
||||
this.m_strPlainData = "";
|
||||
this.m_strCipherDateTime = "";
|
||||
this.m_strCipherIPAddress = "";
|
||||
if (var1.trim().length() != 0 && var1.trim().length() <= 127 && var2.trim().length() != 0) {
|
||||
byte var5 = 0;
|
||||
boolean var6 = false;
|
||||
byte var7 = 0;
|
||||
boolean var8 = false;
|
||||
boolean var9 = false;
|
||||
boolean var10 = false;
|
||||
Object var11 = null;
|
||||
Object var12 = null;
|
||||
Object var13 = null;
|
||||
Object var14 = null;
|
||||
Object var15 = null;
|
||||
Object var16 = null;
|
||||
Object var17 = null;
|
||||
Object var18 = null;
|
||||
Object var19 = null;
|
||||
Object var20 = null;
|
||||
Object var21 = null;
|
||||
Object var22 = null;
|
||||
Object var23 = null;
|
||||
Object var24 = null;
|
||||
String var25 = var1.trim();
|
||||
String var26 = var2.trim();
|
||||
String var27 = null;
|
||||
|
||||
try {
|
||||
byte[] var35 = this.base64Decode(var3);
|
||||
if (var35 != null && this.checkCipherVersion(var35) == 0) {
|
||||
int var33 = var35.length;
|
||||
Byte var4 = new Byte(var35[2]);
|
||||
int var32 = var4.intValue();
|
||||
int var31 = var7 + 3;
|
||||
var31 += var32;
|
||||
if (var33 > 3 + var32 + 32 + 32 + 48) {
|
||||
byte[] var37 = new byte[32];
|
||||
|
||||
int var30;
|
||||
for(var30 = 0; var30 < 32; ++var30) {
|
||||
var37[var30] = var35[var31];
|
||||
++var31;
|
||||
}
|
||||
|
||||
byte[] var36 = new byte[32];
|
||||
|
||||
for(var30 = 0; var30 < 32; ++var30) {
|
||||
var36[var30] = var35[var31];
|
||||
++var31;
|
||||
}
|
||||
|
||||
byte[] var40 = new byte[48];
|
||||
|
||||
for(var30 = 0; var30 < 48; ++var30) {
|
||||
var40[var30] = var35[var31];
|
||||
++var31;
|
||||
}
|
||||
|
||||
byte[] var38 = getHashValue(var25 + var26);
|
||||
if (var36 != null && var38 != null && compareHashValue(var36, var38)) {
|
||||
byte[] var41 = getHashValue(getHashValue(var26));
|
||||
byte[] var42 = new byte[16];
|
||||
byte[] var43 = new byte[16];
|
||||
|
||||
for(var30 = 0; var30 < 16; ++var30) {
|
||||
var42[var30] = var41[var30];
|
||||
var43[var30] = var41[16 + var30];
|
||||
}
|
||||
|
||||
byte[] var44 = getDecodeValue(var42, var43, var40);
|
||||
if (var44 != null) {
|
||||
int var34 = var33 - var31;
|
||||
byte[] var47 = new byte[var34];
|
||||
|
||||
for(var30 = 0; var30 < var34; ++var30) {
|
||||
var47[var30] = var35[var31];
|
||||
++var31;
|
||||
}
|
||||
|
||||
byte[] var45 = new byte[16];
|
||||
byte[] var46 = new byte[16];
|
||||
|
||||
for(var30 = 0; var30 < 16; ++var30) {
|
||||
var45[var30] = var44[var30];
|
||||
var46[var30] = var44[16 + var30];
|
||||
}
|
||||
|
||||
byte[] var48 = getDecodeValue(var45, var46, var47);
|
||||
if (var48 != null) {
|
||||
byte[] var39 = getHashValue(var48);
|
||||
if (compareHashValue(var37, var39)) {
|
||||
var27 = new String(var48, "euc-kr");
|
||||
if (var48.length >= 29 && var27.charAt(12) == '^' && var27.charAt(28) == '^') {
|
||||
this.m_strCipherDateTime = var27.substring(0, 12);
|
||||
this.m_strCipherIPAddress = var27.substring(13, 28);
|
||||
this.m_strPlainData = var27.substring(29);
|
||||
} else {
|
||||
var5 = -6;
|
||||
}
|
||||
} else {
|
||||
var5 = -5;
|
||||
}
|
||||
} else {
|
||||
var5 = -4;
|
||||
}
|
||||
} else {
|
||||
var5 = -6;
|
||||
}
|
||||
} else {
|
||||
var5 = -12;
|
||||
}
|
||||
} else {
|
||||
var5 = -6;
|
||||
}
|
||||
} else {
|
||||
var5 = -6;
|
||||
}
|
||||
} catch (IOException var29) {
|
||||
var5 = -4;
|
||||
} catch (Exception var29) {
|
||||
var5 = -4;
|
||||
}
|
||||
|
||||
return var5;
|
||||
} else {
|
||||
return -9;
|
||||
}
|
||||
}
|
||||
|
||||
private static int getRandomValue() {
|
||||
Random var0 = new Random(System.currentTimeMillis());
|
||||
return Math.abs(var0.nextInt());
|
||||
}
|
||||
|
||||
private static byte[] getHashValue(String var0) throws Exception {
|
||||
return getHashValue(var0.getBytes("euc-kr"));
|
||||
}
|
||||
|
||||
private static byte[] getHashValue(byte[] var0) {
|
||||
boolean var1 = true;
|
||||
MessageDigest var2 = null;
|
||||
byte[] var3 = null;
|
||||
|
||||
try {
|
||||
var2 = MessageDigest.getInstance("SHA-256");
|
||||
var2.reset();
|
||||
var2.update(var0);
|
||||
var3 = new byte[32];
|
||||
var3 = var2.digest();
|
||||
} catch (NoSuchAlgorithmException var5) {
|
||||
var1 = false;
|
||||
}
|
||||
|
||||
return var1 ? var3 : null;
|
||||
}
|
||||
|
||||
private static boolean compareHashValue(byte[] var0, byte[] var1) {
|
||||
boolean var2 = false;
|
||||
boolean var3 = true;
|
||||
if (var0.length == 32 && var1.length == 32) {
|
||||
for(int var4 = 0; var4 < 32; ++var4) {
|
||||
if (var0[var4] != var1[var4]) {
|
||||
var3 = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] getEncodeValue(byte[] var0, byte[] var1, byte[] var2) {
|
||||
boolean var3 = true;
|
||||
SecretKeySpec var4 = null;
|
||||
Cipher var5 = null;
|
||||
byte[] var6 = null;
|
||||
|
||||
try {
|
||||
var4 = new SecretKeySpec(var0, "AES");
|
||||
var5 = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
|
||||
var5.init(1, var4, new IvParameterSpec(var1));
|
||||
var6 = var5.doFinal(var2);
|
||||
} catch (GeneralSecurityException var8) {
|
||||
var3 = false;
|
||||
}
|
||||
|
||||
return var3 ? var6 : null;
|
||||
}
|
||||
|
||||
private static byte[] getDecodeValue(byte[] var0, byte[] var1, byte[] var2) {
|
||||
boolean var3 = true;
|
||||
SecretKeySpec var4 = null;
|
||||
Cipher var5 = null;
|
||||
byte[] var6 = null;
|
||||
|
||||
try {
|
||||
var4 = new SecretKeySpec(var0, "AES");
|
||||
var5 = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
|
||||
var5.init(2, var4, new IvParameterSpec(var1));
|
||||
var6 = var5.doFinal(var2);
|
||||
} catch (GeneralSecurityException var8) {
|
||||
var3 = false;
|
||||
}
|
||||
|
||||
return var3 ? var6 : null;
|
||||
}
|
||||
|
||||
private int checkCipherVersion(byte[] var1) {
|
||||
boolean var2 = true;
|
||||
|
||||
byte var7;
|
||||
try {
|
||||
if (var1 != null && var1.length >= 3) {
|
||||
Byte var3 = new Byte(var1[0]);
|
||||
Byte var4 = new Byte(var1[1]);
|
||||
if (var3.compareTo(new Byte((byte)2)) == 0 && var4.compareTo(new Byte((byte)0)) == 0) {
|
||||
var7 = 0;
|
||||
} else {
|
||||
var7 = -7;
|
||||
}
|
||||
} else {
|
||||
var7 = -8;
|
||||
}
|
||||
} catch (RuntimeException var6) {
|
||||
var7 = -8;
|
||||
}
|
||||
|
||||
return var7;
|
||||
}
|
||||
|
||||
private static String getLocalIPAddr() {
|
||||
boolean var0 = false;
|
||||
boolean var1 = false;
|
||||
String var2 = "";
|
||||
|
||||
try {
|
||||
var2 = InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (IOException var4) {
|
||||
var2 = "UNKNOWN_ADDRESS";
|
||||
}
|
||||
|
||||
int var6 = 16 - var2.length() - 1;
|
||||
if (var6 > 0) {
|
||||
for(int var5 = 0; var5 < var6; ++var5) {
|
||||
var2 = var2 + " ";
|
||||
}
|
||||
}
|
||||
|
||||
return var2.substring(0, 15);
|
||||
}
|
||||
|
||||
private static boolean checkNumber(String var0) {
|
||||
int var1 = var0.length();
|
||||
boolean var2 = false;
|
||||
|
||||
for(int var3 = 0; var3 < var1; ++var3) {
|
||||
char var4 = var0.charAt(var3);
|
||||
if (var4 < '0' || var4 > '9') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static {
|
||||
byte[] var0 = new byte[]{65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
|
||||
mBase64EncMap = var0;
|
||||
mBase64DecMap = new byte[128];
|
||||
|
||||
for(int var1 = 0; var1 < mBase64EncMap.length; ++var1) {
|
||||
mBase64DecMap[mBase64EncMap[var1]] = (byte)var1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,329 @@
|
||||
package gtpa.brs.security;
|
||||
|
||||
public class KISA_SEED
|
||||
{
|
||||
private static final int KC0 = 0x9e3779b9;
|
||||
private static final int KC1 = 0x3c6ef373;
|
||||
private static final int KC2 = 0x78dde6e6;
|
||||
private static final int KC3 = 0xf1bbcdcc;
|
||||
private static final int KC4 = 0xe3779b99;
|
||||
private static final int KC5 = 0xc6ef3733;
|
||||
private static final int KC6 = 0x8dde6e67;
|
||||
private static final int KC7 = 0x1bbcdccf;
|
||||
private static final int KC8 = 0x3779b99e;
|
||||
private static final int KC9 = 0x6ef3733c;
|
||||
private static final int KC10 = 0xdde6e678;
|
||||
private static final int KC11 = 0xbbcdccf1;
|
||||
private static final int KC12 = 0x779b99e3;
|
||||
private static final int KC13 = 0xef3733c6;
|
||||
private static final int KC14 = 0xde6e678d;
|
||||
private static final int KC15 = 0xbcdccf1b;
|
||||
|
||||
private static final int SS0[] =
|
||||
{
|
||||
0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124,
|
||||
0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360,
|
||||
0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314,
|
||||
0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec,
|
||||
0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074,
|
||||
0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100,
|
||||
0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8,
|
||||
0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8,
|
||||
0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c,
|
||||
0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4,
|
||||
0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008,
|
||||
0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0,
|
||||
0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8,
|
||||
0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208,
|
||||
0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064,
|
||||
0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264,
|
||||
0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0,
|
||||
0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc,
|
||||
0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038,
|
||||
0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394,
|
||||
0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188,
|
||||
0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4,
|
||||
0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8,
|
||||
0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4,
|
||||
0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040,
|
||||
0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154,
|
||||
0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254,
|
||||
0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8,
|
||||
0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0,
|
||||
0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088,
|
||||
0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330,
|
||||
0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298
|
||||
};
|
||||
|
||||
private static final int SS1[] =
|
||||
{
|
||||
0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0,
|
||||
0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53,
|
||||
0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3,
|
||||
0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43,
|
||||
0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0,
|
||||
0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890,
|
||||
0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3,
|
||||
0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272,
|
||||
0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83,
|
||||
0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430,
|
||||
0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0,
|
||||
0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1,
|
||||
0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1,
|
||||
0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171,
|
||||
0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951,
|
||||
0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0,
|
||||
0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3,
|
||||
0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41,
|
||||
0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62,
|
||||
0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0,
|
||||
0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303,
|
||||
0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901,
|
||||
0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501,
|
||||
0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343,
|
||||
0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971,
|
||||
0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53,
|
||||
0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642,
|
||||
0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1,
|
||||
0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70,
|
||||
0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393,
|
||||
0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783,
|
||||
0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3
|
||||
};
|
||||
|
||||
private static final int SS2[] =
|
||||
{
|
||||
0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505,
|
||||
0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343,
|
||||
0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707,
|
||||
0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece,
|
||||
0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444,
|
||||
0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101,
|
||||
0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9,
|
||||
0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9,
|
||||
0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f,
|
||||
0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5,
|
||||
0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808,
|
||||
0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1,
|
||||
0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b,
|
||||
0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a,
|
||||
0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444,
|
||||
0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646,
|
||||
0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0,
|
||||
0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf,
|
||||
0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808,
|
||||
0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787,
|
||||
0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989,
|
||||
0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4,
|
||||
0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888,
|
||||
0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484,
|
||||
0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040,
|
||||
0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545,
|
||||
0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646,
|
||||
0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca,
|
||||
0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282,
|
||||
0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888,
|
||||
0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303,
|
||||
0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a
|
||||
};
|
||||
|
||||
private static final int SS3[] =
|
||||
{
|
||||
0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838,
|
||||
0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b,
|
||||
0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427,
|
||||
0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b,
|
||||
0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434,
|
||||
0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818,
|
||||
0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f,
|
||||
0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032,
|
||||
0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b,
|
||||
0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434,
|
||||
0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838,
|
||||
0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839,
|
||||
0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031,
|
||||
0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031,
|
||||
0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819,
|
||||
0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010,
|
||||
0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f,
|
||||
0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d,
|
||||
0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e,
|
||||
0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c,
|
||||
0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003,
|
||||
0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809,
|
||||
0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405,
|
||||
0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003,
|
||||
0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839,
|
||||
0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f,
|
||||
0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406,
|
||||
0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d,
|
||||
0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c,
|
||||
0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013,
|
||||
0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407,
|
||||
0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437
|
||||
};
|
||||
|
||||
private static final byte GetB0(int A) { return (byte)( A & 0x0FF); }
|
||||
private static final byte GetB1(int A) { return (byte)((A>> 8) & 0x0FF); }
|
||||
private static final byte GetB2(int A) { return (byte)((A>>16) & 0x0FF); }
|
||||
private static final byte GetB3(int A) { return (byte)((A>>24) & 0x0FF); }
|
||||
|
||||
private static final void RoundKeyUpdate0(int T[], int[] K, int K_offset, int ABCD[], int KC)
|
||||
{
|
||||
T[0] = ABCD[0] + ABCD[2] - KC;
|
||||
T[1] = ABCD[1] + KC - ABCD[3];
|
||||
|
||||
K[K_offset+0] = SS0[GetB0(T[0]) & 0x0FF] ^ SS1[GetB1(T[0]) & 0x0FF] ^
|
||||
SS2[GetB2(T[0]) & 0x0FF] ^ SS3[GetB3(T[0]) & 0x0FF];
|
||||
K[K_offset+1] = SS0[GetB0(T[1]) & 0x0FF] ^ SS1[GetB1(T[1]) & 0x0FF] ^
|
||||
SS2[GetB2(T[1]) & 0x0FF] ^ SS3[GetB3(T[1]) & 0x0FF];
|
||||
|
||||
T[0] = ABCD[0];
|
||||
|
||||
ABCD[0] = ((ABCD[0]>>8)&0x00ffffff) ^ (ABCD[1]<<24);
|
||||
ABCD[1] = ((ABCD[1]>>8)&0x00ffffff) ^ (T[0]<<24);
|
||||
}
|
||||
|
||||
private static final void RoundKeyUpdate1(int T[], int []K, int K_offset, int ABCD[], int KC)
|
||||
{
|
||||
T[0] = ABCD[0] + ABCD[2] - KC;
|
||||
T[1] = ABCD[1] + KC - ABCD[3];
|
||||
|
||||
K[K_offset+0] = SS0[GetB0(T[0]) & 0x0FF] ^ SS1[GetB1(T[0]) & 0x0FF] ^
|
||||
SS2[GetB2(T[0]) & 0x0FF] ^ SS3[GetB3(T[0]) & 0x0FF];
|
||||
K[K_offset+1] = SS0[GetB0(T[1]) & 0x0FF] ^ SS1[GetB1(T[1]) & 0x0FF] ^
|
||||
SS2[GetB2(T[1]) & 0x0FF] ^ SS3[GetB3(T[1]) & 0x0FF];
|
||||
|
||||
T[0] = ABCD[2];
|
||||
|
||||
ABCD[2] = (ABCD[2]<<8) ^ ((ABCD[3]>>24)&0x000000ff);
|
||||
ABCD[3] = (ABCD[3]<<8) ^ ((T[0]>>24)&0x000000ff);
|
||||
}
|
||||
|
||||
private static final void SeedRound(int[] T, int LR[], int L0, int L1, int R0, int R1, int[] K, int K_offset)
|
||||
{
|
||||
T[0] = LR[R0] ^ K[K_offset + 0];
|
||||
T[1] = LR[R1] ^ K[K_offset + 1];
|
||||
|
||||
T[1] ^= T[0];
|
||||
T[1] = SS0[GetB0(T[1]) & 0x0FF] ^ SS1[GetB1(T[1]) & 0x0FF] ^
|
||||
SS2[GetB2(T[1]) & 0x0FF] ^ SS3[GetB3(T[1]) & 0x0FF];
|
||||
|
||||
T[0] += T[1];
|
||||
T[0] = SS0[GetB0(T[0]) & 0x0FF] ^ SS1[GetB1(T[0]) & 0x0FF] ^
|
||||
SS2[GetB2(T[0]) & 0x0FF] ^ SS3[GetB3(T[0]) & 0x0FF];
|
||||
|
||||
T[1] += T[0];
|
||||
T[1] = SS0[GetB0(T[1]) & 0x0FF] ^ SS1[GetB1(T[1]) & 0x0FF] ^
|
||||
SS2[GetB2(T[1]) & 0x0FF] ^ SS3[GetB3(T[1]) & 0x0FF];
|
||||
|
||||
T[0] += T[1];
|
||||
LR[L0] ^= T[0]; LR[L1] ^= T[1];
|
||||
}
|
||||
|
||||
private static int Byte2Word(byte[] src, int src_offset)
|
||||
{
|
||||
return ((src[src_offset] & 0x0FF) << 24) | ((src[src_offset + 1] & 0x0FF) << 16) | ((src[src_offset + 2] & 0x0FF) << 8) | ((src[src_offset + 3] & 0x0FF));
|
||||
}
|
||||
|
||||
public void SEED_KeySched(byte[] mKey, int[] rKey)
|
||||
{
|
||||
int ABCD[] = new int[4];
|
||||
int T[] = new int[2];
|
||||
|
||||
ABCD[0] = Byte2Word(mKey, 0);
|
||||
ABCD[1] = Byte2Word(mKey, 4);
|
||||
ABCD[2] = Byte2Word(mKey, 8);
|
||||
ABCD[3] = Byte2Word(mKey,12);
|
||||
|
||||
RoundKeyUpdate0(T, rKey, 0, ABCD, KC0 );
|
||||
RoundKeyUpdate1(T, rKey, 2, ABCD, KC1 );
|
||||
RoundKeyUpdate0(T, rKey, 4, ABCD, KC2 );
|
||||
RoundKeyUpdate1(T, rKey, 6, ABCD, KC3 );
|
||||
RoundKeyUpdate0(T, rKey, 8, ABCD, KC4 );
|
||||
RoundKeyUpdate1(T, rKey, 10, ABCD, KC5 );
|
||||
RoundKeyUpdate0(T, rKey, 12, ABCD, KC6 );
|
||||
RoundKeyUpdate1(T, rKey, 14, ABCD, KC7 );
|
||||
RoundKeyUpdate0(T, rKey, 16, ABCD, KC8 );
|
||||
RoundKeyUpdate1(T, rKey, 18, ABCD, KC9 );
|
||||
RoundKeyUpdate0(T, rKey, 20, ABCD, KC10);
|
||||
RoundKeyUpdate1(T, rKey, 22, ABCD, KC11);
|
||||
RoundKeyUpdate0(T, rKey, 24, ABCD, KC12);
|
||||
RoundKeyUpdate1(T, rKey, 26, ABCD, KC13);
|
||||
RoundKeyUpdate0(T, rKey, 28, ABCD, KC14);
|
||||
|
||||
T[0] = ABCD[0] + ABCD[2] - KC15;
|
||||
T[1] = ABCD[1] - ABCD[3] + KC15;
|
||||
|
||||
rKey[30] = SS0[GetB0(T[0]) & 0x0FF] ^ SS1[GetB1(T[0]) & 0x0FF] ^
|
||||
SS2[GetB2(T[0]) & 0x0FF] ^ SS3[GetB3(T[0]) & 0x0FF];
|
||||
rKey[31] = SS0[GetB0(T[1]) & 0x0FF] ^ SS1[GetB1(T[1]) & 0x0FF] ^
|
||||
SS2[GetB2(T[1]) & 0x0FF] ^ SS3[GetB3(T[1]) & 0x0FF];
|
||||
}
|
||||
|
||||
public void SEED_Encrypt(int[] pOut, int[] pIn, int[] rKey)
|
||||
{
|
||||
int LR[] = new int[4];
|
||||
int T[] = new int[2];
|
||||
|
||||
LR[0] = pIn[0];
|
||||
LR[1] = pIn[1];
|
||||
LR[2] = pIn[2];
|
||||
LR[3] = pIn[3];
|
||||
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 0);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 2);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 4);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 6);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 8);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 10);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 12);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 14);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 16);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 18);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 20);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 22);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 24);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 26);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 28);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 30);
|
||||
|
||||
pOut[0] = LR[2];
|
||||
pOut[1] = LR[3];
|
||||
pOut[2] = LR[0];
|
||||
pOut[3] = LR[1];
|
||||
}
|
||||
|
||||
public void SEED_Decrypt(int[] pOut, int[] pIn, int[] rKey)
|
||||
{
|
||||
int LR[] = new int[4];
|
||||
int T[] = new int[2];
|
||||
|
||||
LR[0] = pIn[0];
|
||||
LR[1] = pIn[1];
|
||||
LR[2] = pIn[2];
|
||||
LR[3] = pIn[3];
|
||||
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 30);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 28);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 26);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 24);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 22);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 20);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 18);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 16);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 14);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 12);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 10);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 8);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 6);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 4);
|
||||
SeedRound(T, LR, 0, 1, 2, 3, rKey, 2);
|
||||
SeedRound(T, LR, 2, 3, 0, 1, rKey, 0);
|
||||
|
||||
pOut[0] = LR[2];
|
||||
pOut[1] = LR[3];
|
||||
pOut[2] = LR[0];
|
||||
pOut[3] = LR[1];
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,970 @@
|
||||
package gtpa.brs.security;
|
||||
/**
|
||||
* @author Copyright (c) 2013 by KISA
|
||||
* @file KISA_SEED_CBC.java
|
||||
* @brief SEED CBC 암호 알고리즘
|
||||
* @remarks http://seed.kisa.or.kr/
|
||||
*/
|
||||
|
||||
public class KISA_SEED_CBC {
|
||||
|
||||
// DEFAULT : JAVA = BIG_ENDIAN
|
||||
private static int ENDIAN = Common.BIG_ENDIAN;
|
||||
|
||||
// S-BOX
|
||||
private static final int SS0[] =
|
||||
{
|
||||
0x2989a1a8, 0x05858184, 0x16c6d2d4, 0x13c3d3d0, 0x14445054, 0x1d0d111c, 0x2c8ca0ac, 0x25052124,
|
||||
0x1d4d515c, 0x03434340, 0x18081018, 0x1e0e121c, 0x11415150, 0x3cccf0fc, 0x0acac2c8, 0x23436360,
|
||||
0x28082028, 0x04444044, 0x20002020, 0x1d8d919c, 0x20c0e0e0, 0x22c2e2e0, 0x08c8c0c8, 0x17071314,
|
||||
0x2585a1a4, 0x0f8f838c, 0x03030300, 0x3b4b7378, 0x3b8bb3b8, 0x13031310, 0x12c2d2d0, 0x2ecee2ec,
|
||||
0x30407070, 0x0c8c808c, 0x3f0f333c, 0x2888a0a8, 0x32023230, 0x1dcdd1dc, 0x36c6f2f4, 0x34447074,
|
||||
0x2ccce0ec, 0x15859194, 0x0b0b0308, 0x17475354, 0x1c4c505c, 0x1b4b5358, 0x3d8db1bc, 0x01010100,
|
||||
0x24042024, 0x1c0c101c, 0x33437370, 0x18889098, 0x10001010, 0x0cccc0cc, 0x32c2f2f0, 0x19c9d1d8,
|
||||
0x2c0c202c, 0x27c7e3e4, 0x32427270, 0x03838380, 0x1b8b9398, 0x11c1d1d0, 0x06868284, 0x09c9c1c8,
|
||||
0x20406060, 0x10405050, 0x2383a3a0, 0x2bcbe3e8, 0x0d0d010c, 0x3686b2b4, 0x1e8e929c, 0x0f4f434c,
|
||||
0x3787b3b4, 0x1a4a5258, 0x06c6c2c4, 0x38487078, 0x2686a2a4, 0x12021210, 0x2f8fa3ac, 0x15c5d1d4,
|
||||
0x21416160, 0x03c3c3c0, 0x3484b0b4, 0x01414140, 0x12425250, 0x3d4d717c, 0x0d8d818c, 0x08080008,
|
||||
0x1f0f131c, 0x19899198, 0x00000000, 0x19091118, 0x04040004, 0x13435350, 0x37c7f3f4, 0x21c1e1e0,
|
||||
0x3dcdf1fc, 0x36467274, 0x2f0f232c, 0x27072324, 0x3080b0b0, 0x0b8b8388, 0x0e0e020c, 0x2b8ba3a8,
|
||||
0x2282a2a0, 0x2e4e626c, 0x13839390, 0x0d4d414c, 0x29496168, 0x3c4c707c, 0x09090108, 0x0a0a0208,
|
||||
0x3f8fb3bc, 0x2fcfe3ec, 0x33c3f3f0, 0x05c5c1c4, 0x07878384, 0x14041014, 0x3ecef2fc, 0x24446064,
|
||||
0x1eced2dc, 0x2e0e222c, 0x0b4b4348, 0x1a0a1218, 0x06060204, 0x21012120, 0x2b4b6368, 0x26466264,
|
||||
0x02020200, 0x35c5f1f4, 0x12829290, 0x0a8a8288, 0x0c0c000c, 0x3383b3b0, 0x3e4e727c, 0x10c0d0d0,
|
||||
0x3a4a7278, 0x07474344, 0x16869294, 0x25c5e1e4, 0x26062224, 0x00808080, 0x2d8da1ac, 0x1fcfd3dc,
|
||||
0x2181a1a0, 0x30003030, 0x37073334, 0x2e8ea2ac, 0x36063234, 0x15051114, 0x22022220, 0x38083038,
|
||||
0x34c4f0f4, 0x2787a3a4, 0x05454144, 0x0c4c404c, 0x01818180, 0x29c9e1e8, 0x04848084, 0x17879394,
|
||||
0x35053134, 0x0bcbc3c8, 0x0ecec2cc, 0x3c0c303c, 0x31417170, 0x11011110, 0x07c7c3c4, 0x09898188,
|
||||
0x35457174, 0x3bcbf3f8, 0x1acad2d8, 0x38c8f0f8, 0x14849094, 0x19495158, 0x02828280, 0x04c4c0c4,
|
||||
0x3fcff3fc, 0x09494148, 0x39093138, 0x27476364, 0x00c0c0c0, 0x0fcfc3cc, 0x17c7d3d4, 0x3888b0b8,
|
||||
0x0f0f030c, 0x0e8e828c, 0x02424240, 0x23032320, 0x11819190, 0x2c4c606c, 0x1bcbd3d8, 0x2484a0a4,
|
||||
0x34043034, 0x31c1f1f0, 0x08484048, 0x02c2c2c0, 0x2f4f636c, 0x3d0d313c, 0x2d0d212c, 0x00404040,
|
||||
0x3e8eb2bc, 0x3e0e323c, 0x3c8cb0bc, 0x01c1c1c0, 0x2a8aa2a8, 0x3a8ab2b8, 0x0e4e424c, 0x15455154,
|
||||
0x3b0b3338, 0x1cccd0dc, 0x28486068, 0x3f4f737c, 0x1c8c909c, 0x18c8d0d8, 0x0a4a4248, 0x16465254,
|
||||
0x37477374, 0x2080a0a0, 0x2dcde1ec, 0x06464244, 0x3585b1b4, 0x2b0b2328, 0x25456164, 0x3acaf2f8,
|
||||
0x23c3e3e0, 0x3989b1b8, 0x3181b1b0, 0x1f8f939c, 0x1e4e525c, 0x39c9f1f8, 0x26c6e2e4, 0x3282b2b0,
|
||||
0x31013130, 0x2acae2e8, 0x2d4d616c, 0x1f4f535c, 0x24c4e0e4, 0x30c0f0f0, 0x0dcdc1cc, 0x08888088,
|
||||
0x16061214, 0x3a0a3238, 0x18485058, 0x14c4d0d4, 0x22426260, 0x29092128, 0x07070304, 0x33033330,
|
||||
0x28c8e0e8, 0x1b0b1318, 0x05050104, 0x39497178, 0x10809090, 0x2a4a6268, 0x2a0a2228, 0x1a8a9298
|
||||
};
|
||||
|
||||
private static final int SS1[] =
|
||||
{
|
||||
0x38380830, 0xe828c8e0, 0x2c2d0d21, 0xa42686a2, 0xcc0fcfc3, 0xdc1eced2, 0xb03383b3, 0xb83888b0,
|
||||
0xac2f8fa3, 0x60204060, 0x54154551, 0xc407c7c3, 0x44044440, 0x6c2f4f63, 0x682b4b63, 0x581b4b53,
|
||||
0xc003c3c3, 0x60224262, 0x30330333, 0xb43585b1, 0x28290921, 0xa02080a0, 0xe022c2e2, 0xa42787a3,
|
||||
0xd013c3d3, 0x90118191, 0x10110111, 0x04060602, 0x1c1c0c10, 0xbc3c8cb0, 0x34360632, 0x480b4b43,
|
||||
0xec2fcfe3, 0x88088880, 0x6c2c4c60, 0xa82888a0, 0x14170713, 0xc404c4c0, 0x14160612, 0xf434c4f0,
|
||||
0xc002c2c2, 0x44054541, 0xe021c1e1, 0xd416c6d2, 0x3c3f0f33, 0x3c3d0d31, 0x8c0e8e82, 0x98188890,
|
||||
0x28280820, 0x4c0e4e42, 0xf436c6f2, 0x3c3e0e32, 0xa42585a1, 0xf839c9f1, 0x0c0d0d01, 0xdc1fcfd3,
|
||||
0xd818c8d0, 0x282b0b23, 0x64264662, 0x783a4a72, 0x24270723, 0x2c2f0f23, 0xf031c1f1, 0x70324272,
|
||||
0x40024242, 0xd414c4d0, 0x40014141, 0xc000c0c0, 0x70334373, 0x64274763, 0xac2c8ca0, 0x880b8b83,
|
||||
0xf437c7f3, 0xac2d8da1, 0x80008080, 0x1c1f0f13, 0xc80acac2, 0x2c2c0c20, 0xa82a8aa2, 0x34340430,
|
||||
0xd012c2d2, 0x080b0b03, 0xec2ecee2, 0xe829c9e1, 0x5c1d4d51, 0x94148490, 0x18180810, 0xf838c8f0,
|
||||
0x54174753, 0xac2e8ea2, 0x08080800, 0xc405c5c1, 0x10130313, 0xcc0dcdc1, 0x84068682, 0xb83989b1,
|
||||
0xfc3fcff3, 0x7c3d4d71, 0xc001c1c1, 0x30310131, 0xf435c5f1, 0x880a8a82, 0x682a4a62, 0xb03181b1,
|
||||
0xd011c1d1, 0x20200020, 0xd417c7d3, 0x00020202, 0x20220222, 0x04040400, 0x68284860, 0x70314171,
|
||||
0x04070703, 0xd81bcbd3, 0x9c1d8d91, 0x98198991, 0x60214161, 0xbc3e8eb2, 0xe426c6e2, 0x58194951,
|
||||
0xdc1dcdd1, 0x50114151, 0x90108090, 0xdc1cccd0, 0x981a8a92, 0xa02383a3, 0xa82b8ba3, 0xd010c0d0,
|
||||
0x80018181, 0x0c0f0f03, 0x44074743, 0x181a0a12, 0xe023c3e3, 0xec2ccce0, 0x8c0d8d81, 0xbc3f8fb3,
|
||||
0x94168692, 0x783b4b73, 0x5c1c4c50, 0xa02282a2, 0xa02181a1, 0x60234363, 0x20230323, 0x4c0d4d41,
|
||||
0xc808c8c0, 0x9c1e8e92, 0x9c1c8c90, 0x383a0a32, 0x0c0c0c00, 0x2c2e0e22, 0xb83a8ab2, 0x6c2e4e62,
|
||||
0x9c1f8f93, 0x581a4a52, 0xf032c2f2, 0x90128292, 0xf033c3f3, 0x48094941, 0x78384870, 0xcc0cccc0,
|
||||
0x14150511, 0xf83bcbf3, 0x70304070, 0x74354571, 0x7c3f4f73, 0x34350531, 0x10100010, 0x00030303,
|
||||
0x64244460, 0x6c2d4d61, 0xc406c6c2, 0x74344470, 0xd415c5d1, 0xb43484b0, 0xe82acae2, 0x08090901,
|
||||
0x74364672, 0x18190911, 0xfc3ecef2, 0x40004040, 0x10120212, 0xe020c0e0, 0xbc3d8db1, 0x04050501,
|
||||
0xf83acaf2, 0x00010101, 0xf030c0f0, 0x282a0a22, 0x5c1e4e52, 0xa82989a1, 0x54164652, 0x40034343,
|
||||
0x84058581, 0x14140410, 0x88098981, 0x981b8b93, 0xb03080b0, 0xe425c5e1, 0x48084840, 0x78394971,
|
||||
0x94178793, 0xfc3cccf0, 0x1c1e0e12, 0x80028282, 0x20210121, 0x8c0c8c80, 0x181b0b13, 0x5c1f4f53,
|
||||
0x74374773, 0x54144450, 0xb03282b2, 0x1c1d0d11, 0x24250521, 0x4c0f4f43, 0x00000000, 0x44064642,
|
||||
0xec2dcde1, 0x58184850, 0x50124252, 0xe82bcbe3, 0x7c3e4e72, 0xd81acad2, 0xc809c9c1, 0xfc3dcdf1,
|
||||
0x30300030, 0x94158591, 0x64254561, 0x3c3c0c30, 0xb43686b2, 0xe424c4e0, 0xb83b8bb3, 0x7c3c4c70,
|
||||
0x0c0e0e02, 0x50104050, 0x38390931, 0x24260622, 0x30320232, 0x84048480, 0x68294961, 0x90138393,
|
||||
0x34370733, 0xe427c7e3, 0x24240420, 0xa42484a0, 0xc80bcbc3, 0x50134353, 0x080a0a02, 0x84078783,
|
||||
0xd819c9d1, 0x4c0c4c40, 0x80038383, 0x8c0f8f83, 0xcc0ecec2, 0x383b0b33, 0x480a4a42, 0xb43787b3
|
||||
};
|
||||
|
||||
private static final int SS2[] =
|
||||
{
|
||||
0xa1a82989, 0x81840585, 0xd2d416c6, 0xd3d013c3, 0x50541444, 0x111c1d0d, 0xa0ac2c8c, 0x21242505,
|
||||
0x515c1d4d, 0x43400343, 0x10181808, 0x121c1e0e, 0x51501141, 0xf0fc3ccc, 0xc2c80aca, 0x63602343,
|
||||
0x20282808, 0x40440444, 0x20202000, 0x919c1d8d, 0xe0e020c0, 0xe2e022c2, 0xc0c808c8, 0x13141707,
|
||||
0xa1a42585, 0x838c0f8f, 0x03000303, 0x73783b4b, 0xb3b83b8b, 0x13101303, 0xd2d012c2, 0xe2ec2ece,
|
||||
0x70703040, 0x808c0c8c, 0x333c3f0f, 0xa0a82888, 0x32303202, 0xd1dc1dcd, 0xf2f436c6, 0x70743444,
|
||||
0xe0ec2ccc, 0x91941585, 0x03080b0b, 0x53541747, 0x505c1c4c, 0x53581b4b, 0xb1bc3d8d, 0x01000101,
|
||||
0x20242404, 0x101c1c0c, 0x73703343, 0x90981888, 0x10101000, 0xc0cc0ccc, 0xf2f032c2, 0xd1d819c9,
|
||||
0x202c2c0c, 0xe3e427c7, 0x72703242, 0x83800383, 0x93981b8b, 0xd1d011c1, 0x82840686, 0xc1c809c9,
|
||||
0x60602040, 0x50501040, 0xa3a02383, 0xe3e82bcb, 0x010c0d0d, 0xb2b43686, 0x929c1e8e, 0x434c0f4f,
|
||||
0xb3b43787, 0x52581a4a, 0xc2c406c6, 0x70783848, 0xa2a42686, 0x12101202, 0xa3ac2f8f, 0xd1d415c5,
|
||||
0x61602141, 0xc3c003c3, 0xb0b43484, 0x41400141, 0x52501242, 0x717c3d4d, 0x818c0d8d, 0x00080808,
|
||||
0x131c1f0f, 0x91981989, 0x00000000, 0x11181909, 0x00040404, 0x53501343, 0xf3f437c7, 0xe1e021c1,
|
||||
0xf1fc3dcd, 0x72743646, 0x232c2f0f, 0x23242707, 0xb0b03080, 0x83880b8b, 0x020c0e0e, 0xa3a82b8b,
|
||||
0xa2a02282, 0x626c2e4e, 0x93901383, 0x414c0d4d, 0x61682949, 0x707c3c4c, 0x01080909, 0x02080a0a,
|
||||
0xb3bc3f8f, 0xe3ec2fcf, 0xf3f033c3, 0xc1c405c5, 0x83840787, 0x10141404, 0xf2fc3ece, 0x60642444,
|
||||
0xd2dc1ece, 0x222c2e0e, 0x43480b4b, 0x12181a0a, 0x02040606, 0x21202101, 0x63682b4b, 0x62642646,
|
||||
0x02000202, 0xf1f435c5, 0x92901282, 0x82880a8a, 0x000c0c0c, 0xb3b03383, 0x727c3e4e, 0xd0d010c0,
|
||||
0x72783a4a, 0x43440747, 0x92941686, 0xe1e425c5, 0x22242606, 0x80800080, 0xa1ac2d8d, 0xd3dc1fcf,
|
||||
0xa1a02181, 0x30303000, 0x33343707, 0xa2ac2e8e, 0x32343606, 0x11141505, 0x22202202, 0x30383808,
|
||||
0xf0f434c4, 0xa3a42787, 0x41440545, 0x404c0c4c, 0x81800181, 0xe1e829c9, 0x80840484, 0x93941787,
|
||||
0x31343505, 0xc3c80bcb, 0xc2cc0ece, 0x303c3c0c, 0x71703141, 0x11101101, 0xc3c407c7, 0x81880989,
|
||||
0x71743545, 0xf3f83bcb, 0xd2d81aca, 0xf0f838c8, 0x90941484, 0x51581949, 0x82800282, 0xc0c404c4,
|
||||
0xf3fc3fcf, 0x41480949, 0x31383909, 0x63642747, 0xc0c000c0, 0xc3cc0fcf, 0xd3d417c7, 0xb0b83888,
|
||||
0x030c0f0f, 0x828c0e8e, 0x42400242, 0x23202303, 0x91901181, 0x606c2c4c, 0xd3d81bcb, 0xa0a42484,
|
||||
0x30343404, 0xf1f031c1, 0x40480848, 0xc2c002c2, 0x636c2f4f, 0x313c3d0d, 0x212c2d0d, 0x40400040,
|
||||
0xb2bc3e8e, 0x323c3e0e, 0xb0bc3c8c, 0xc1c001c1, 0xa2a82a8a, 0xb2b83a8a, 0x424c0e4e, 0x51541545,
|
||||
0x33383b0b, 0xd0dc1ccc, 0x60682848, 0x737c3f4f, 0x909c1c8c, 0xd0d818c8, 0x42480a4a, 0x52541646,
|
||||
0x73743747, 0xa0a02080, 0xe1ec2dcd, 0x42440646, 0xb1b43585, 0x23282b0b, 0x61642545, 0xf2f83aca,
|
||||
0xe3e023c3, 0xb1b83989, 0xb1b03181, 0x939c1f8f, 0x525c1e4e, 0xf1f839c9, 0xe2e426c6, 0xb2b03282,
|
||||
0x31303101, 0xe2e82aca, 0x616c2d4d, 0x535c1f4f, 0xe0e424c4, 0xf0f030c0, 0xc1cc0dcd, 0x80880888,
|
||||
0x12141606, 0x32383a0a, 0x50581848, 0xd0d414c4, 0x62602242, 0x21282909, 0x03040707, 0x33303303,
|
||||
0xe0e828c8, 0x13181b0b, 0x01040505, 0x71783949, 0x90901080, 0x62682a4a, 0x22282a0a, 0x92981a8a
|
||||
};
|
||||
|
||||
private static final int SS3[] =
|
||||
{
|
||||
0x08303838, 0xc8e0e828, 0x0d212c2d, 0x86a2a426, 0xcfc3cc0f, 0xced2dc1e, 0x83b3b033, 0x88b0b838,
|
||||
0x8fa3ac2f, 0x40606020, 0x45515415, 0xc7c3c407, 0x44404404, 0x4f636c2f, 0x4b63682b, 0x4b53581b,
|
||||
0xc3c3c003, 0x42626022, 0x03333033, 0x85b1b435, 0x09212829, 0x80a0a020, 0xc2e2e022, 0x87a3a427,
|
||||
0xc3d3d013, 0x81919011, 0x01111011, 0x06020406, 0x0c101c1c, 0x8cb0bc3c, 0x06323436, 0x4b43480b,
|
||||
0xcfe3ec2f, 0x88808808, 0x4c606c2c, 0x88a0a828, 0x07131417, 0xc4c0c404, 0x06121416, 0xc4f0f434,
|
||||
0xc2c2c002, 0x45414405, 0xc1e1e021, 0xc6d2d416, 0x0f333c3f, 0x0d313c3d, 0x8e828c0e, 0x88909818,
|
||||
0x08202828, 0x4e424c0e, 0xc6f2f436, 0x0e323c3e, 0x85a1a425, 0xc9f1f839, 0x0d010c0d, 0xcfd3dc1f,
|
||||
0xc8d0d818, 0x0b23282b, 0x46626426, 0x4a72783a, 0x07232427, 0x0f232c2f, 0xc1f1f031, 0x42727032,
|
||||
0x42424002, 0xc4d0d414, 0x41414001, 0xc0c0c000, 0x43737033, 0x47636427, 0x8ca0ac2c, 0x8b83880b,
|
||||
0xc7f3f437, 0x8da1ac2d, 0x80808000, 0x0f131c1f, 0xcac2c80a, 0x0c202c2c, 0x8aa2a82a, 0x04303434,
|
||||
0xc2d2d012, 0x0b03080b, 0xcee2ec2e, 0xc9e1e829, 0x4d515c1d, 0x84909414, 0x08101818, 0xc8f0f838,
|
||||
0x47535417, 0x8ea2ac2e, 0x08000808, 0xc5c1c405, 0x03131013, 0xcdc1cc0d, 0x86828406, 0x89b1b839,
|
||||
0xcff3fc3f, 0x4d717c3d, 0xc1c1c001, 0x01313031, 0xc5f1f435, 0x8a82880a, 0x4a62682a, 0x81b1b031,
|
||||
0xc1d1d011, 0x00202020, 0xc7d3d417, 0x02020002, 0x02222022, 0x04000404, 0x48606828, 0x41717031,
|
||||
0x07030407, 0xcbd3d81b, 0x8d919c1d, 0x89919819, 0x41616021, 0x8eb2bc3e, 0xc6e2e426, 0x49515819,
|
||||
0xcdd1dc1d, 0x41515011, 0x80909010, 0xccd0dc1c, 0x8a92981a, 0x83a3a023, 0x8ba3a82b, 0xc0d0d010,
|
||||
0x81818001, 0x0f030c0f, 0x47434407, 0x0a12181a, 0xc3e3e023, 0xcce0ec2c, 0x8d818c0d, 0x8fb3bc3f,
|
||||
0x86929416, 0x4b73783b, 0x4c505c1c, 0x82a2a022, 0x81a1a021, 0x43636023, 0x03232023, 0x4d414c0d,
|
||||
0xc8c0c808, 0x8e929c1e, 0x8c909c1c, 0x0a32383a, 0x0c000c0c, 0x0e222c2e, 0x8ab2b83a, 0x4e626c2e,
|
||||
0x8f939c1f, 0x4a52581a, 0xc2f2f032, 0x82929012, 0xc3f3f033, 0x49414809, 0x48707838, 0xccc0cc0c,
|
||||
0x05111415, 0xcbf3f83b, 0x40707030, 0x45717435, 0x4f737c3f, 0x05313435, 0x00101010, 0x03030003,
|
||||
0x44606424, 0x4d616c2d, 0xc6c2c406, 0x44707434, 0xc5d1d415, 0x84b0b434, 0xcae2e82a, 0x09010809,
|
||||
0x46727436, 0x09111819, 0xcef2fc3e, 0x40404000, 0x02121012, 0xc0e0e020, 0x8db1bc3d, 0x05010405,
|
||||
0xcaf2f83a, 0x01010001, 0xc0f0f030, 0x0a22282a, 0x4e525c1e, 0x89a1a829, 0x46525416, 0x43434003,
|
||||
0x85818405, 0x04101414, 0x89818809, 0x8b93981b, 0x80b0b030, 0xc5e1e425, 0x48404808, 0x49717839,
|
||||
0x87939417, 0xccf0fc3c, 0x0e121c1e, 0x82828002, 0x01212021, 0x8c808c0c, 0x0b13181b, 0x4f535c1f,
|
||||
0x47737437, 0x44505414, 0x82b2b032, 0x0d111c1d, 0x05212425, 0x4f434c0f, 0x00000000, 0x46424406,
|
||||
0xcde1ec2d, 0x48505818, 0x42525012, 0xcbe3e82b, 0x4e727c3e, 0xcad2d81a, 0xc9c1c809, 0xcdf1fc3d,
|
||||
0x00303030, 0x85919415, 0x45616425, 0x0c303c3c, 0x86b2b436, 0xc4e0e424, 0x8bb3b83b, 0x4c707c3c,
|
||||
0x0e020c0e, 0x40505010, 0x09313839, 0x06222426, 0x02323032, 0x84808404, 0x49616829, 0x83939013,
|
||||
0x07333437, 0xc7e3e427, 0x04202424, 0x84a0a424, 0xcbc3c80b, 0x43535013, 0x0a02080a, 0x87838407,
|
||||
0xc9d1d819, 0x4c404c0c, 0x83838003, 0x8f838c0f, 0xcec2cc0e, 0x0b33383b, 0x4a42480a, 0x87b3b437
|
||||
};
|
||||
|
||||
private static final int BLOCK_SIZE_SEED = 16;
|
||||
private static final int BLOCK_SIZE_SEED_INT = 4;
|
||||
|
||||
private static final byte GetB0(int A) {
|
||||
return (byte) (A & 0x0ff);
|
||||
}
|
||||
|
||||
private static final byte GetB1(int A) {
|
||||
return (byte) ((A >> 8) & 0x0ff);
|
||||
}
|
||||
|
||||
private static final byte GetB2(int A) {
|
||||
return (byte) ((A >> 16) & 0x0ff);
|
||||
}
|
||||
|
||||
private static final byte GetB3(int A) {
|
||||
return (byte) ((A >> 24) & 0x0ff);
|
||||
}
|
||||
|
||||
// Round function F and adding output of F to L.
|
||||
// L0, L1 : left input values at each round
|
||||
// R0, R1 : right input values at each round
|
||||
// K : round keys at each round
|
||||
private static final void SeedRound(int[] T, int LR[], int L0, int L1, int R0, int R1, int[] K, int K_offset) {
|
||||
T[0] = LR[R0] ^ K[K_offset + 0];
|
||||
T[1] = LR[R1] ^ K[K_offset + 1];
|
||||
T[1] ^= T[0];
|
||||
T[1] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^
|
||||
SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
T[0] += T[1];
|
||||
T[0] = SS0[GetB0(T[0]) & 0x0ff] ^ SS1[GetB1(T[0]) & 0x0ff] ^
|
||||
SS2[GetB2(T[0]) & 0x0ff] ^ SS3[GetB3(T[0]) & 0x0ff];
|
||||
T[1] += T[0];
|
||||
T[1] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^
|
||||
SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
T[0] += T[1];
|
||||
LR[L0] ^= T[0];
|
||||
LR[L1] ^= T[1];
|
||||
}
|
||||
|
||||
|
||||
private static final int EndianChange(int dwS) {
|
||||
return ((/*ROTL(dwS,8)*/(((dwS) << (8)) | (((dwS) >> (32 - (8))) & 0x000000ff)) & 0x00ff00ff) | (/*ROTL(dwS,24)*/(((dwS) << (24)) | (((dwS) >> (32 - (24))) & 0x00ffffff)) & 0xff00ff00));
|
||||
}
|
||||
|
||||
/************************ Constants for Key schedule **************************/
|
||||
private static final int KC0 = 0x9e3779b9;
|
||||
private static final int KC1 = 0x3c6ef373;
|
||||
private static final int KC2 = 0x78dde6e6;
|
||||
private static final int KC3 = 0xf1bbcdcc;
|
||||
private static final int KC4 = 0xe3779b99;
|
||||
private static final int KC5 = 0xc6ef3733;
|
||||
private static final int KC6 = 0x8dde6e67;
|
||||
private static final int KC7 = 0x1bbcdccf;
|
||||
private static final int KC8 = 0x3779b99e;
|
||||
private static final int KC9 = 0x6ef3733c;
|
||||
private static final int KC10 = 0xdde6e678;
|
||||
private static final int KC11 = 0xbbcdccf1;
|
||||
private static final int KC12 = 0x779b99e3;
|
||||
private static final int KC13 = 0xef3733c6;
|
||||
private static final int KC14 = 0xde6e678d;
|
||||
private static final int KC15 = 0xbcdccf1b;
|
||||
|
||||
|
||||
private static final int ABCD_A = 0;
|
||||
private static final int ABCD_B = 1;
|
||||
private static final int ABCD_C = 2;
|
||||
private static final int ABCD_D = 3;
|
||||
|
||||
private static final void RoundKeyUpdate0(int T[], int[] K, int K_offset, int ABCD[], int KC) {
|
||||
T[0] = ABCD[ABCD_A] + ABCD[ABCD_C] - KC;
|
||||
T[1] = ABCD[ABCD_B] + KC - ABCD[ABCD_D];
|
||||
K[K_offset + 0] = SS0[GetB0(T[0]) & 0x0ff] ^ SS1[GetB1(T[0]) & 0x0ff] ^ SS2[GetB2(T[0]) & 0x0ff] ^ SS3[GetB3(T[0]) & 0x0ff];
|
||||
K[K_offset + 1] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^ SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
T[0] = ABCD[ABCD_A];
|
||||
ABCD[ABCD_A] = ((ABCD[ABCD_A] >> 8) & 0x00ffffff) ^ (ABCD[ABCD_B] << 24);
|
||||
ABCD[ABCD_B] = ((ABCD[ABCD_B] >> 8) & 0x00ffffff) ^ (T[0] << 24);
|
||||
}
|
||||
|
||||
private static final void RoundKeyUpdate1(int T[], int[] K, int K_offset, int ABCD[], int KC) {
|
||||
T[0] = ABCD[ABCD_A] + ABCD[ABCD_C] - KC;
|
||||
T[1] = ABCD[ABCD_B] + KC - ABCD[ABCD_D];
|
||||
K[K_offset + 0] = SS0[GetB0(T[0]) & 0x0ff] ^ SS1[GetB1(T[0]) & 0x0ff] ^ SS2[GetB2(T[0]) & 0x0ff] ^ SS3[GetB3(T[0]) & 0x0ff];
|
||||
K[K_offset + 1] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^ SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
T[0] = ABCD[ABCD_C];
|
||||
ABCD[ABCD_C] = (ABCD[ABCD_C] << 8) ^ ((ABCD[ABCD_D] >> 24) & 0x000000ff);
|
||||
ABCD[ABCD_D] = (ABCD[ABCD_D] << 8) ^ ((T[0] >> 24) & 0x000000ff);
|
||||
}
|
||||
|
||||
private static void BLOCK_XOR_CBC(int[] OUT_VALUE, int out_value_offset, int[] IN_VALUE1, int in_value1_offset, int[] IN_VALUE2, int in_value2_offset) {
|
||||
OUT_VALUE[out_value_offset + 0] = (in_value1_offset < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 0] : 0) ^ (in_value2_offset < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 0] : 0);
|
||||
OUT_VALUE[out_value_offset + 1] = (in_value1_offset + 1 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 1] : 0) ^ (in_value2_offset + 1 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 1] : 0);
|
||||
OUT_VALUE[out_value_offset + 2] = (in_value1_offset + 2 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 2] : 0) ^ (in_value2_offset + 2 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 2] : 0);
|
||||
OUT_VALUE[out_value_offset + 3] = (in_value1_offset + 3 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 3] : 0) ^ (in_value2_offset + 3 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 3] : 0);
|
||||
}
|
||||
|
||||
private static final int LR_L0 = 0;
|
||||
private static final int LR_L1 = 1;
|
||||
private static final int LR_R0 = 2;
|
||||
private static final int LR_R1 = 3;
|
||||
|
||||
private static void KISA_SEED_Encrypt_Block_forCBC(int[] in, int in_offset, int[] out, int out_offset, KISA_SEED_KEY ks) {
|
||||
int LR[] = new int[4]; // Iuput/output values at each rounds
|
||||
int T[] = new int[2]; // Temporary variables for round function F
|
||||
int K[] = ks.key_data; // Pointer of round keys
|
||||
|
||||
// Set up input values for first round
|
||||
LR[LR_L0] = in[in_offset + 0];
|
||||
LR[LR_L1] = in[in_offset + 1];
|
||||
LR[LR_R0] = in[in_offset + 2];
|
||||
LR[LR_R1] = in[in_offset + 3];
|
||||
|
||||
// Reorder for big endian
|
||||
// Because SEED use little endian order in default
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
LR[LR_L0] = EndianChange(LR[LR_L0]);
|
||||
LR[LR_L1] = EndianChange(LR[LR_L1]);
|
||||
LR[LR_R0] = EndianChange(LR[LR_R0]);
|
||||
LR[LR_R1] = EndianChange(LR[LR_R1]);
|
||||
}
|
||||
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 0); // Round 1
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 2); // Round 2
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 4); // Round 3
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 6); // Round 4
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 8); // Round 5
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 10); // Round 6
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 12); // Round 7
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 14); // Round 8
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 16); // Round 9
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 18); // Round 10
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 20); // Round 11
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 22); // Round 12
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 24); // Round 13
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 26); // Round 14
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 28); // Round 15
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 30); // Round 16
|
||||
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
LR[LR_L0] = EndianChange(LR[LR_L0]);
|
||||
LR[LR_L1] = EndianChange(LR[LR_L1]);
|
||||
LR[LR_R0] = EndianChange(LR[LR_R0]);
|
||||
LR[LR_R1] = EndianChange(LR[LR_R1]);
|
||||
}
|
||||
|
||||
// Copying output values from last round to pbData
|
||||
out[out_offset + 0] = LR[LR_R0];
|
||||
out[out_offset + 1] = LR[LR_R1];
|
||||
out[out_offset + 2] = LR[LR_L0];
|
||||
out[out_offset + 3] = LR[LR_L1];
|
||||
|
||||
}
|
||||
|
||||
private static void KISA_SEED_Decrypt_Block_forCBC(int[] in, int in_offset, int[] out, int out_offset, KISA_SEED_KEY ks) {
|
||||
int LR[] = new int[4]; // Iuput/output values at each rounds
|
||||
int T[] = new int[2]; // Temporary variables for round function F
|
||||
int K[] = ks.key_data; // Pointer of round keys
|
||||
|
||||
// Set up input values for first round
|
||||
LR[LR_L0] = in[in_offset + 0];
|
||||
LR[LR_L1] = in[in_offset + 1];
|
||||
LR[LR_R0] = in[in_offset + 2];
|
||||
LR[LR_R1] = in[in_offset + 3];
|
||||
|
||||
// Reorder for big endian
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
LR[LR_L0] = EndianChange(LR[LR_L0]);
|
||||
LR[LR_L1] = EndianChange(LR[LR_L1]);
|
||||
LR[LR_R0] = EndianChange(LR[LR_R0]);
|
||||
LR[LR_R1] = EndianChange(LR[LR_R1]);
|
||||
}
|
||||
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 30); // Round 1
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 28); // Round 2
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 26); // Round 3
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 24); // Round 4
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 22); // Round 5
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 20); // Round 6
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 18); // Round 7
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 16); // Round 8
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 14); // Round 9
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 12); // Round 10
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 10); // Round 11
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 8); // Round 12
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 6); // Round 13
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 4); // Round 14
|
||||
SeedRound(T, LR, LR_L0, LR_L1, LR_R0, LR_R1, K, 2); // Round 15
|
||||
SeedRound(T, LR, LR_R0, LR_R1, LR_L0, LR_L1, K, 0); // Round 16
|
||||
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
LR[LR_L0] = EndianChange(LR[LR_L0]);
|
||||
LR[LR_L1] = EndianChange(LR[LR_L1]);
|
||||
LR[LR_R0] = EndianChange(LR[LR_R0]);
|
||||
LR[LR_R1] = EndianChange(LR[LR_R1]);
|
||||
}
|
||||
|
||||
// Copy output values from last round to pbData
|
||||
out[out_offset + 0] = LR[LR_R0];
|
||||
out[out_offset + 1] = LR[LR_R1];
|
||||
out[out_offset + 2] = LR[LR_L0];
|
||||
out[out_offset + 3] = LR[LR_L1];
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int[] chartoint32_for_SEED_CBC(byte[] in, int inLen) {
|
||||
int[] data;
|
||||
int len, i;
|
||||
|
||||
if (inLen % 4 > 0)
|
||||
len = (inLen / 4) + 1;
|
||||
else
|
||||
len = (inLen / 4);
|
||||
|
||||
data = new int[len];
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
Common.byte_to_int(data, i, in, i * 4, ENDIAN);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] int32tochar_for_SEED_CBC(int in[], int inLen) {
|
||||
byte[] data;
|
||||
int i;
|
||||
|
||||
data = new byte[inLen];
|
||||
if (ENDIAN != Common.BIG_ENDIAN) {
|
||||
for (i = 0; i < inLen; i++) {
|
||||
data[i] = (byte) (in[i / 4] >> ((i % 4) * 8));
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < inLen; i++) {
|
||||
data[i] = (byte) (in[i / 4] >> ((3 - (i % 4)) * 8));
|
||||
}
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public static int SEED_CBC_init(KISA_SEED_INFO pInfo, KISA_ENC_DEC enc, byte[] pbszUserKey, byte[] pbszIV) {
|
||||
int ABCD[] = new int[4]; // Iuput/output values at each rounds(각 라운드 입/출력)
|
||||
int T[] = new int[2]; // Temporary variable
|
||||
int K[];
|
||||
|
||||
if (null == pInfo ||
|
||||
null == pbszUserKey ||
|
||||
null == pbszIV)
|
||||
return 0;
|
||||
|
||||
K = pInfo.seed_key.key_data; // Pointer of round keys
|
||||
pInfo.encrypt = enc.value; //
|
||||
Common.memcpy(pInfo.ivec, pbszIV, 16, ENDIAN);
|
||||
pInfo.last_block_flag = pInfo.buffer_length = 0;
|
||||
|
||||
// Set up input values for Key Schedule
|
||||
ABCD[ABCD_A] = Common.byte_to_int(pbszUserKey, 0 * 4, ENDIAN);
|
||||
ABCD[ABCD_B] = Common.byte_to_int(pbszUserKey, 1 * 4, ENDIAN);
|
||||
ABCD[ABCD_C] = Common.byte_to_int(pbszUserKey, 2 * 4, ENDIAN);
|
||||
ABCD[ABCD_D] = Common.byte_to_int(pbszUserKey, 3 * 4, ENDIAN);
|
||||
|
||||
// Reorder for big endian
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
ABCD[ABCD_A] = EndianChange(ABCD[ABCD_A]);
|
||||
ABCD[ABCD_B] = EndianChange(ABCD[ABCD_B]);
|
||||
ABCD[ABCD_C] = EndianChange(ABCD[ABCD_C]);
|
||||
ABCD[ABCD_D] = EndianChange(ABCD[ABCD_D]);
|
||||
}
|
||||
|
||||
// i-th round keys( K_i,0 and K_i,1 ) are denoted as K[2*(i-1)] and K[2*i-1], respectively
|
||||
RoundKeyUpdate0(T, K, 0, ABCD, KC0); // K_1,0 and K_1,1
|
||||
RoundKeyUpdate1(T, K, 2, ABCD, KC1); // K_2,0 and K_2,1
|
||||
RoundKeyUpdate0(T, K, 4, ABCD, KC2); // K_3,0 and K_3,1
|
||||
RoundKeyUpdate1(T, K, 6, ABCD, KC3); // K_4,0 and K_4,1
|
||||
RoundKeyUpdate0(T, K, 8, ABCD, KC4); // K_5,0 and K_5,1
|
||||
RoundKeyUpdate1(T, K, 10, ABCD, KC5); // K_6,0 and K_6,1
|
||||
RoundKeyUpdate0(T, K, 12, ABCD, KC6); // K_7,0 and K_7,1
|
||||
RoundKeyUpdate1(T, K, 14, ABCD, KC7); // K_8,0 and K_8,1
|
||||
RoundKeyUpdate0(T, K, 16, ABCD, KC8); // K_9,0 and K_9,1
|
||||
RoundKeyUpdate1(T, K, 18, ABCD, KC9); // K_10,0 and K_10,1
|
||||
RoundKeyUpdate0(T, K, 20, ABCD, KC10); // K_11,0 and K_11,1
|
||||
RoundKeyUpdate1(T, K, 22, ABCD, KC11); // K_12,0 and K_12,1
|
||||
RoundKeyUpdate0(T, K, 24, ABCD, KC12); // K_13,0 and K_13,1
|
||||
RoundKeyUpdate1(T, K, 26, ABCD, KC13); // K_14,0 and K_14,1
|
||||
RoundKeyUpdate0(T, K, 28, ABCD, KC14); // K_15,0 and K_15,1
|
||||
|
||||
T[0] = ABCD[ABCD_A] + ABCD[ABCD_C] - KC15;
|
||||
T[1] = ABCD[ABCD_B] - ABCD[ABCD_D] + KC15;
|
||||
|
||||
K[30] = SS0[GetB0(T[0]) & 0x0ff] ^ SS1[GetB1(T[0]) & 0x0ff] ^ // K_16,0
|
||||
SS2[GetB2(T[0]) & 0x0ff] ^ SS3[GetB3(T[0]) & 0x0ff];
|
||||
K[31] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^ // K_16,1
|
||||
SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int SEED_CBC_Process(KISA_SEED_INFO pInfo, int[] in, int inLen, int[] out, int[] outLen) {
|
||||
int nCurrentCount = BLOCK_SIZE_SEED;
|
||||
int[] pdwXOR = null;
|
||||
int in_offset = 0;
|
||||
int out_offset = 0;
|
||||
int pdwXOR_offset = 0;
|
||||
|
||||
if (null == pInfo ||
|
||||
null == in ||
|
||||
null == out ||
|
||||
0 > inLen)
|
||||
return 0;
|
||||
|
||||
|
||||
if (KISA_ENC_DEC._KISA_ENCRYPT == pInfo.encrypt) {
|
||||
pdwXOR = pInfo.ivec;
|
||||
in_offset = 0;
|
||||
out_offset = 0;
|
||||
pdwXOR_offset = 0;
|
||||
|
||||
|
||||
while (nCurrentCount <= inLen) {
|
||||
BLOCK_XOR_CBC(out, out_offset, in, in_offset, pdwXOR, pdwXOR_offset);
|
||||
|
||||
KISA_SEED_Encrypt_Block_forCBC(out, out_offset, out, out_offset, pInfo.seed_key);
|
||||
|
||||
pdwXOR = out;
|
||||
pdwXOR_offset = out_offset;
|
||||
|
||||
nCurrentCount += BLOCK_SIZE_SEED;
|
||||
in_offset += BLOCK_SIZE_SEED_INT;
|
||||
out_offset += BLOCK_SIZE_SEED_INT;
|
||||
}
|
||||
|
||||
outLen[0] = nCurrentCount - BLOCK_SIZE_SEED;
|
||||
pInfo.buffer_length = (inLen - outLen[0]);
|
||||
|
||||
Common.memcpy(pInfo.ivec, pdwXOR, pdwXOR_offset, BLOCK_SIZE_SEED);
|
||||
Common.memcpy(pInfo.cbc_buffer, in, in_offset, pInfo.buffer_length);
|
||||
} else {
|
||||
pdwXOR = pInfo.ivec;
|
||||
in_offset = 0;
|
||||
out_offset = 0;
|
||||
pdwXOR_offset = 0;
|
||||
|
||||
while (nCurrentCount <= inLen) {
|
||||
KISA_SEED_Decrypt_Block_forCBC(in, in_offset, out, out_offset, pInfo.seed_key);
|
||||
|
||||
BLOCK_XOR_CBC(out, out_offset, out, out_offset, pdwXOR, pdwXOR_offset);
|
||||
|
||||
pdwXOR = in;
|
||||
pdwXOR_offset = in_offset;
|
||||
|
||||
nCurrentCount += BLOCK_SIZE_SEED;
|
||||
in_offset += BLOCK_SIZE_SEED_INT;
|
||||
out_offset += BLOCK_SIZE_SEED_INT;
|
||||
}
|
||||
|
||||
outLen[0] = nCurrentCount - BLOCK_SIZE_SEED;
|
||||
|
||||
|
||||
Common.memcpy(pInfo.ivec, pdwXOR, pdwXOR_offset, BLOCK_SIZE_SEED);
|
||||
Common.memcpy(pInfo.cbc_last_block, out, out_offset - BLOCK_SIZE_SEED_INT, BLOCK_SIZE_SEED);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int SEED_CBC_Close(KISA_SEED_INFO pInfo, int[] out, int out_offset, int[] outLen) {
|
||||
int nPaddngLeng;
|
||||
int i;
|
||||
|
||||
outLen[0] = 0;
|
||||
|
||||
if (null == out)
|
||||
return 0;
|
||||
|
||||
if (KISA_ENC_DEC._KISA_ENCRYPT == pInfo.encrypt) {
|
||||
nPaddngLeng = BLOCK_SIZE_SEED - pInfo.buffer_length;
|
||||
|
||||
for (i = pInfo.buffer_length; i < BLOCK_SIZE_SEED; i++) {
|
||||
Common.set_byte_for_int(pInfo.cbc_buffer, i, (byte) nPaddngLeng, ENDIAN);
|
||||
}
|
||||
BLOCK_XOR_CBC(pInfo.cbc_buffer, 0, pInfo.cbc_buffer, 0, pInfo.ivec, 0);
|
||||
|
||||
KISA_SEED_Encrypt_Block_forCBC(pInfo.cbc_buffer, 0, out, out_offset, pInfo.seed_key);
|
||||
|
||||
outLen[0] = BLOCK_SIZE_SEED;
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
nPaddngLeng = Common.get_byte_for_int(pInfo.cbc_last_block, BLOCK_SIZE_SEED - 1, ENDIAN);
|
||||
|
||||
|
||||
if (nPaddngLeng > 0 && nPaddngLeng <= BLOCK_SIZE_SEED) {
|
||||
for (i = nPaddngLeng; i > 0; i--) {
|
||||
Common.set_byte_for_int(out, out_offset - i, (byte) 0x00, ENDIAN);
|
||||
}
|
||||
|
||||
outLen[0] = nPaddngLeng;
|
||||
} else
|
||||
return 0;
|
||||
|
||||
|
||||
}
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static byte[] SEED_CBC_Encrypt(byte[] pbszUserKey, byte[] pbszIV, byte[] message, int message_offset, int message_length) {
|
||||
KISA_SEED_INFO info = new KISA_SEED_INFO();
|
||||
int[] outbuf;
|
||||
int[] data;
|
||||
byte[] cdata;
|
||||
int outlen;
|
||||
int nRetOutLeng[] = new int[]{0};
|
||||
int nPaddingLeng[] = new int[]{0};
|
||||
|
||||
byte[] pbszPlainText = new byte[message_length];
|
||||
System.arraycopy(message, message_offset, pbszPlainText, 0, message_length);
|
||||
int nPlainTextLen = pbszPlainText.length;
|
||||
|
||||
|
||||
int nPlainTextPadding = BLOCK_SIZE_SEED - (nPlainTextLen % BLOCK_SIZE_SEED);
|
||||
byte[] newpbszPlainText = new byte[nPlainTextLen + nPlainTextPadding];
|
||||
Common.arraycopy(newpbszPlainText, pbszPlainText, nPlainTextLen);
|
||||
|
||||
byte[] pbszCipherText = new byte[newpbszPlainText.length];
|
||||
|
||||
|
||||
SEED_CBC_init(info, KISA_ENC_DEC.KISA_ENCRYPT, pbszUserKey, pbszIV);
|
||||
|
||||
outlen = ((newpbszPlainText.length / BLOCK_SIZE_SEED)) * BLOCK_SIZE_SEED_INT;
|
||||
outbuf = new int[outlen];
|
||||
data = chartoint32_for_SEED_CBC(newpbszPlainText, nPlainTextLen);
|
||||
|
||||
SEED_CBC_Process(info, data, nPlainTextLen, outbuf, nRetOutLeng);
|
||||
SEED_CBC_Close(info, outbuf, (nRetOutLeng[0] / 4), nPaddingLeng);
|
||||
|
||||
cdata = int32tochar_for_SEED_CBC(outbuf, nRetOutLeng[0] + nPaddingLeng[0]);
|
||||
Common.arraycopy(pbszCipherText, cdata, nRetOutLeng[0] + nPaddingLeng[0]);
|
||||
|
||||
data = null;
|
||||
cdata = null;
|
||||
outbuf = null;
|
||||
|
||||
return pbszCipherText;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] SEED_CBC_Decrypt(byte[] pbszUserKey, byte[] pbszIV, byte[] message, int message_offset, int message_length) {
|
||||
KISA_SEED_INFO info = new KISA_SEED_INFO();
|
||||
int[] outbuf;
|
||||
int[] data;
|
||||
byte[] cdata;
|
||||
int outlen;
|
||||
int nRetOutLeng[] = new int[]{0};
|
||||
int nPaddingLeng[] = new int[]{0};
|
||||
|
||||
|
||||
byte[] pbszCipherText = new byte[message_length];
|
||||
System.arraycopy(message, message_offset, pbszCipherText, 0, message_length);
|
||||
int nCipherTextLen = pbszCipherText.length;
|
||||
|
||||
if ((nCipherTextLen % BLOCK_SIZE_SEED) != 0) {
|
||||
byte result[] = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
byte[] newpbszCipherText = new byte[nCipherTextLen];
|
||||
Common.arraycopy(newpbszCipherText, pbszCipherText, nCipherTextLen);
|
||||
|
||||
nCipherTextLen = newpbszCipherText.length;
|
||||
|
||||
|
||||
SEED_CBC_init(info, KISA_ENC_DEC.KISA_DECRYPT, pbszUserKey, pbszIV);
|
||||
|
||||
outlen = ((nCipherTextLen / 16)) * 4;
|
||||
outbuf = new int[outlen];
|
||||
data = chartoint32_for_SEED_CBC(newpbszCipherText, nCipherTextLen);
|
||||
|
||||
SEED_CBC_Process(info, data, nCipherTextLen, outbuf, nRetOutLeng);
|
||||
|
||||
|
||||
if (SEED_CBC_Close(info, outbuf, (nRetOutLeng[0]), nPaddingLeng) == 1) {
|
||||
cdata = int32tochar_for_SEED_CBC(outbuf, nRetOutLeng[0] - nPaddingLeng[0]);
|
||||
|
||||
byte[] pbszPlainText = new byte[nRetOutLeng[0] - nPaddingLeng[0]];
|
||||
|
||||
Common.arraycopy(pbszPlainText, cdata, nRetOutLeng[0] - nPaddingLeng[0]);
|
||||
|
||||
int pdmessage_length = nRetOutLeng[0] - nPaddingLeng[0];
|
||||
byte[] result = new byte[pdmessage_length];
|
||||
System.arraycopy(pbszPlainText, 0, result, 0, pdmessage_length);
|
||||
|
||||
data = null;
|
||||
cdata = null;
|
||||
outbuf = null;
|
||||
|
||||
return result;
|
||||
|
||||
} else {
|
||||
byte result[] = null;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static final class KISA_ENC_DEC {
|
||||
public static final int _KISA_DECRYPT = 0;
|
||||
public static final int _KISA_ENCRYPT = 1;
|
||||
|
||||
public int value;
|
||||
|
||||
public KISA_ENC_DEC(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static final KISA_ENC_DEC KISA_ENCRYPT = new KISA_ENC_DEC(_KISA_ENCRYPT);
|
||||
public static final KISA_ENC_DEC KISA_DECRYPT = new KISA_ENC_DEC(_KISA_DECRYPT);
|
||||
|
||||
}
|
||||
|
||||
public static final class KISA_SEED_KEY {
|
||||
public int[] key_data = new int[32];
|
||||
|
||||
public void init() {
|
||||
for (int i = 0; i < key_data.length; i++) {
|
||||
key_data[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class KISA_SEED_INFO {
|
||||
public int encrypt;
|
||||
public int ivec[] = new int[4];
|
||||
public KISA_SEED_KEY seed_key = new KISA_SEED_KEY();
|
||||
public int cbc_buffer[] = new int[4];
|
||||
public int buffer_length;
|
||||
public int[] cbc_last_block = new int[4];
|
||||
public int last_block_flag;
|
||||
|
||||
public KISA_SEED_INFO() {
|
||||
encrypt = 0;
|
||||
ivec[0] = ivec[1] = ivec[2] = ivec[3] = 0;
|
||||
seed_key.init();
|
||||
cbc_buffer[0] = cbc_buffer[1] = cbc_buffer[2] = cbc_buffer[3] = 0;
|
||||
buffer_length = 0;
|
||||
cbc_last_block[0] = cbc_last_block[1] = cbc_last_block[2] = cbc_last_block[3] = 0;
|
||||
last_block_flag = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class Common {
|
||||
|
||||
public static final int BIG_ENDIAN = 0;
|
||||
public static final int LITTLE_ENDIAN = 1;
|
||||
|
||||
public static void arraycopy(byte[] dst, byte[] src, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
dst[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
public static void arraycopy_offset(byte[] dst, int dst_offset, byte[] src, int src_offset, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
dst[dst_offset + i] = src[src_offset + i];
|
||||
}
|
||||
}
|
||||
|
||||
public static void arrayinit(byte[] dst, byte value, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
dst[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void arrayinit_offset(byte[] dst, int dst_offset, byte value, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
dst[dst_offset + i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static void memcpy(int[] dst, byte[] src, int length, int ENDIAN) {
|
||||
int iLen = length / 4;
|
||||
for (int i = 0; i < iLen; i++) {
|
||||
byte_to_int(dst, i, src, i * 4, ENDIAN);
|
||||
}
|
||||
}
|
||||
|
||||
public static void memcpy(int[] dst, int[] src, int src_offset, int length) {
|
||||
int iLen = length / 4 + ((length % 4 != 0) ? 1 : 0);
|
||||
for (int i = 0; i < iLen; i++) {
|
||||
dst[i] = src[src_offset + i];
|
||||
}
|
||||
}
|
||||
|
||||
public static void set_byte_for_int(int[] dst, int b_offset, byte value, int ENDIAN) {
|
||||
if (ENDIAN == BIG_ENDIAN) {
|
||||
int shift_value = (3 - b_offset % 4) * 8;
|
||||
int mask_value = 0x0ff << shift_value;
|
||||
int mask_value2 = ~mask_value;
|
||||
int value2 = (value & 0x0ff) << shift_value;
|
||||
dst[b_offset / 4] = (dst[b_offset / 4] & mask_value2) | (value2 & mask_value);
|
||||
} else {
|
||||
int shift_value = (b_offset % 4) * 8;
|
||||
int mask_value = 0x0ff << shift_value;
|
||||
int mask_value2 = ~mask_value;
|
||||
int value2 = (value & 0x0ff) << shift_value;
|
||||
dst[b_offset / 4] = (dst[b_offset / 4] & mask_value2) | (value2 & mask_value);
|
||||
}
|
||||
}
|
||||
|
||||
public static byte get_byte_for_int(int[] src, int b_offset, int ENDIAN) {
|
||||
if (ENDIAN == BIG_ENDIAN) {
|
||||
int shift_value = (3 - b_offset % 4) * 8;
|
||||
int mask_value = 0x0ff << shift_value;
|
||||
int value = (src[b_offset / 4] & mask_value) >> shift_value;
|
||||
return (byte) value;
|
||||
} else {
|
||||
int shift_value = (b_offset % 4) * 8;
|
||||
int mask_value = 0x0ff << shift_value;
|
||||
int value = (src[b_offset / 4] & mask_value) >> shift_value;
|
||||
return (byte) value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static byte[] get_bytes_for_ints(int[] src, int offset, int ENDIAN) {
|
||||
int iLen = src.length - offset;
|
||||
byte[] result = new byte[(iLen) * 4];
|
||||
for (int i = 0; i < iLen; i++) {
|
||||
int_to_byte(result, i * 4, src, offset + i, ENDIAN);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void byte_to_int(int[] dst, int dst_offset, byte[] src, int src_offset, int ENDIAN) {
|
||||
if (ENDIAN == BIG_ENDIAN) {
|
||||
dst[dst_offset] = ((0x0ff & src[src_offset]) << 24) | ((0x0ff & src[src_offset + 1]) << 16) | ((0x0ff & src[src_offset + 2]) << 8) | ((0x0ff & src[src_offset + 3]));
|
||||
} else {
|
||||
dst[dst_offset] = ((0x0ff & src[src_offset])) | ((0x0ff & src[src_offset + 1]) << 8) | ((0x0ff & src[src_offset + 2]) << 16) | ((0x0ff & src[src_offset + 3]) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
public static int byte_to_int(byte[] src, int src_offset, int ENDIAN) {
|
||||
if (ENDIAN == BIG_ENDIAN) {
|
||||
return ((0x0ff & src[src_offset]) << 24) | ((0x0ff & src[src_offset + 1]) << 16) | ((0x0ff & src[src_offset + 2]) << 8) | ((0x0ff & src[src_offset + 3]));
|
||||
} else {
|
||||
return ((0x0ff & src[src_offset])) | ((0x0ff & src[src_offset + 1]) << 8) | ((0x0ff & src[src_offset + 2]) << 16) | ((0x0ff & src[src_offset + 3]) << 24);
|
||||
}
|
||||
}
|
||||
|
||||
public static int byte_to_int_big_endian(byte[] src, int src_offset) {
|
||||
return ((0x0ff & src[src_offset]) << 24) | ((0x0ff & src[src_offset + 1]) << 16) | ((0x0ff & src[src_offset + 2]) << 8) | ((0x0ff & src[src_offset + 3]));
|
||||
}
|
||||
|
||||
public static void int_to_byte(byte[] dst, int dst_offset, int[] src, int src_offset, int ENDIAN) {
|
||||
int_to_byte_unit(dst, dst_offset, src[src_offset], ENDIAN);
|
||||
}
|
||||
|
||||
public static void int_to_byte_unit(byte[] dst, int dst_offset, int src, int ENDIAN) {
|
||||
if (ENDIAN == BIG_ENDIAN) {
|
||||
dst[dst_offset] = (byte) ((src >> 24) & 0x0ff);
|
||||
dst[dst_offset + 1] = (byte) ((src >> 16) & 0x0ff);
|
||||
dst[dst_offset + 2] = (byte) ((src >> 8) & 0x0ff);
|
||||
dst[dst_offset + 3] = (byte) ((src) & 0x0ff);
|
||||
} else {
|
||||
dst[dst_offset] = (byte) ((src) & 0x0ff);
|
||||
dst[dst_offset + 1] = (byte) ((src >> 8) & 0x0ff);
|
||||
dst[dst_offset + 2] = (byte) ((src >> 16) & 0x0ff);
|
||||
dst[dst_offset + 3] = (byte) ((src >> 24) & 0x0ff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void int_to_byte_unit_big_endian(byte[] dst, int dst_offset, int src) {
|
||||
dst[dst_offset] = (byte) ((src >> 24) & 0x0ff);
|
||||
dst[dst_offset + 1] = (byte) ((src >> 16) & 0x0ff);
|
||||
dst[dst_offset + 2] = (byte) ((src >> 8) & 0x0ff);
|
||||
dst[dst_offset + 3] = (byte) ((src) & 0x0ff);
|
||||
}
|
||||
|
||||
public static int URShift(int x, int n) {
|
||||
if (n == 0)
|
||||
return x;
|
||||
if (n >= 32)
|
||||
return 0;
|
||||
int v = x >> n;
|
||||
int v_mask = ~(0x80000000 >> (n - 1));
|
||||
return v & v_mask;
|
||||
}
|
||||
|
||||
public static final long INT_RANGE_MAX = (long) Math.pow(2, 32);
|
||||
|
||||
public static long intToUnsigned(int x) {
|
||||
if (x >= 0)
|
||||
return x;
|
||||
return x + INT_RANGE_MAX;
|
||||
}
|
||||
|
||||
//Padding : PKSC #7
|
||||
//출력 : PADDING 후 길이(바이트단위)
|
||||
public static int Padding(byte[] pbData, byte[] padData, int length) {
|
||||
int i;
|
||||
int padvalue = 16 - (length % 16);
|
||||
Common.arraycopy(padData, pbData, length);
|
||||
i = length;
|
||||
do {
|
||||
padData[i] = (byte) (padvalue);
|
||||
i++;
|
||||
} while ((i % 16) != 0);
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
//1블럭(128비트 XOR)
|
||||
public static void BLOCK_XOR_PROPOSAL(int[] OUT_VALUE, int out_value_offset, int[] IN_VALUE1, int in_value1_offset, int[] IN_VALUE2, int in_value2_offset) {
|
||||
OUT_VALUE[out_value_offset + 0] = (in_value1_offset < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 0] : 0) ^ (in_value2_offset < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 0] : 0);
|
||||
OUT_VALUE[out_value_offset + 1] = (in_value1_offset + 1 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 1] : 0) ^ (in_value2_offset + 1 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 1] : 0);
|
||||
OUT_VALUE[out_value_offset + 2] = (in_value1_offset + 2 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 2] : 0) ^ (in_value2_offset + 2 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 2] : 0);
|
||||
OUT_VALUE[out_value_offset + 3] = (in_value1_offset + 3 < IN_VALUE1.length ? IN_VALUE1[in_value1_offset + 3] : 0) ^ (in_value2_offset + 3 < IN_VALUE2.length ? IN_VALUE2[in_value2_offset + 3] : 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int SeedRoundKey(KISA_SEED_INFO pInfo, KISA_ENC_DEC enc, byte[] pbszUserKey, byte[] pbszIV) {
|
||||
int ABCD[] = new int[4]; // Iuput/output values at each rounds(각 라운드 입/출력)
|
||||
int T[] = new int[2]; // Temporary variable
|
||||
int K[];
|
||||
|
||||
if (null == pInfo ||
|
||||
null == pbszUserKey ||
|
||||
null == pbszIV)
|
||||
return 0;
|
||||
|
||||
K = pInfo.seed_key.key_data; // Pointer of round keys
|
||||
pInfo.encrypt = enc.value; //
|
||||
Common.memcpy(pInfo.ivec, pbszIV, 16, ENDIAN);
|
||||
pInfo.last_block_flag = pInfo.buffer_length = 0;
|
||||
|
||||
// Set up input values for Key Schedule
|
||||
ABCD[ABCD_A] = Common.byte_to_int(pbszUserKey, 0 * 4, ENDIAN);
|
||||
ABCD[ABCD_B] = Common.byte_to_int(pbszUserKey, 1 * 4, ENDIAN);
|
||||
ABCD[ABCD_C] = Common.byte_to_int(pbszUserKey, 2 * 4, ENDIAN);
|
||||
ABCD[ABCD_D] = Common.byte_to_int(pbszUserKey, 3 * 4, ENDIAN);
|
||||
|
||||
// Reorder for big endian
|
||||
if (Common.BIG_ENDIAN != ENDIAN) {
|
||||
ABCD[ABCD_A] = EndianChange(ABCD[ABCD_A]);
|
||||
ABCD[ABCD_B] = EndianChange(ABCD[ABCD_B]);
|
||||
ABCD[ABCD_C] = EndianChange(ABCD[ABCD_C]);
|
||||
ABCD[ABCD_D] = EndianChange(ABCD[ABCD_D]);
|
||||
}
|
||||
|
||||
// i-th round keys( K_i,0 and K_i,1 ) are denoted as K[2*(i-1)] and K[2*i-1], respectively
|
||||
RoundKeyUpdate0(T, K, 0, ABCD, KC0); // K_1,0 and K_1,1
|
||||
RoundKeyUpdate1(T, K, 2, ABCD, KC1); // K_2,0 and K_2,1
|
||||
RoundKeyUpdate0(T, K, 4, ABCD, KC2); // K_3,0 and K_3,1
|
||||
RoundKeyUpdate1(T, K, 6, ABCD, KC3); // K_4,0 and K_4,1
|
||||
RoundKeyUpdate0(T, K, 8, ABCD, KC4); // K_5,0 and K_5,1
|
||||
RoundKeyUpdate1(T, K, 10, ABCD, KC5); // K_6,0 and K_6,1
|
||||
RoundKeyUpdate0(T, K, 12, ABCD, KC6); // K_7,0 and K_7,1
|
||||
RoundKeyUpdate1(T, K, 14, ABCD, KC7); // K_8,0 and K_8,1
|
||||
RoundKeyUpdate0(T, K, 16, ABCD, KC8); // K_9,0 and K_9,1
|
||||
RoundKeyUpdate1(T, K, 18, ABCD, KC9); // K_10,0 and K_10,1
|
||||
RoundKeyUpdate0(T, K, 20, ABCD, KC10); // K_11,0 and K_11,1
|
||||
RoundKeyUpdate1(T, K, 22, ABCD, KC11); // K_12,0 and K_12,1
|
||||
RoundKeyUpdate0(T, K, 24, ABCD, KC12); // K_13,0 and K_13,1
|
||||
RoundKeyUpdate1(T, K, 26, ABCD, KC13); // K_14,0 and K_14,1
|
||||
RoundKeyUpdate0(T, K, 28, ABCD, KC14); // K_15,0 and K_15,1
|
||||
|
||||
T[0] = ABCD[ABCD_A] + ABCD[ABCD_C] - KC15;
|
||||
T[1] = ABCD[ABCD_B] - ABCD[ABCD_D] + KC15;
|
||||
|
||||
K[30] = SS0[GetB0(T[0]) & 0x0ff] ^ SS1[GetB1(T[0]) & 0x0ff] ^ // K_16,0
|
||||
SS2[GetB2(T[0]) & 0x0ff] ^ SS3[GetB3(T[0]) & 0x0ff];
|
||||
K[31] = SS0[GetB0(T[1]) & 0x0ff] ^ SS1[GetB1(T[1]) & 0x0ff] ^ // K_16,1
|
||||
SS2[GetB2(T[1]) & 0x0ff] ^ SS3[GetB3(T[1]) & 0x0ff];
|
||||
|
||||
return 1;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,343 @@
|
||||
package gtpa.brs.security;
|
||||
|
||||
import gtpa.brs.security.KISA_SEED;
|
||||
|
||||
public class KISA_SEED_CCM
|
||||
{
|
||||
private static int BLOCK_SIZE_SEED = 16;
|
||||
|
||||
private static void SHIFTR8(int[] x)
|
||||
{
|
||||
x[3] = ((x[3] >> 8) & 0x00FFFFFF) ^ ((x[2] << 24) & 0xFF000000);
|
||||
x[2] = ((x[2] >> 8) & 0x00FFFFFF) ^ ((x[1] << 24) & 0xFF000000);
|
||||
x[1] = ((x[1] >> 8) & 0x00FFFFFF) ^ ((x[0] << 24) & 0xFF000000);
|
||||
x[0] = ((x[0] >> 8) & 0x00FFFFFF);
|
||||
}
|
||||
|
||||
private static void SHIFTR16(int[] x)
|
||||
{
|
||||
x[3] = ((x[3] >> 16) & 0x0000FFFF) ^ ((x[2] << 16) & 0xFFFF0000);
|
||||
x[2] = ((x[2] >> 16) & 0x0000FFFF) ^ ((x[1] << 16) & 0xFFFF0000);
|
||||
x[1] = ((x[1] >> 16) & 0x0000FFFF) ^ ((x[0] << 16) & 0xFFFF0000);
|
||||
x[0] = ((x[0] >> 16) & 0x0000FFFF);
|
||||
}
|
||||
|
||||
private static void XOR128(int[] R, int[] A, int[] B)
|
||||
{
|
||||
R[0] = A[0] ^ B[0];
|
||||
R[1] = A[1] ^ B[1];
|
||||
R[2] = A[2] ^ B[2];
|
||||
R[3] = A[3] ^ B[3];
|
||||
}
|
||||
|
||||
private static void INCREASE(int[] ctr)
|
||||
{
|
||||
if (ctr[3] == 0xFFFFFFFF)
|
||||
{
|
||||
ctr[2]++;
|
||||
ctr[3] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctr[3]++;
|
||||
}
|
||||
}
|
||||
private static void ZERO128(int[] a) { a[0] = 0x00000000; a[1] = 0x00000000; a[2] = 0x00000000; a[3] = 0x00000000; }
|
||||
|
||||
private static void Byte2Word(int[] dst, byte[] src, int src_offset, int srcLen)
|
||||
{
|
||||
int i = 0;
|
||||
int remain = 0;
|
||||
|
||||
for (i = 0; i < srcLen; i++)
|
||||
{
|
||||
remain = i & 3;
|
||||
|
||||
if (remain == 0)
|
||||
dst[i >> 2] = ((src[src_offset + i] & 0x0FF) << 24);
|
||||
else if (remain == 1)
|
||||
dst[i >> 2] ^= ((src[src_offset + i] & 0x0FF) << 16);
|
||||
else if (remain == 2)
|
||||
dst[i >> 2] ^= ((src[src_offset + i] & 0x0FF) << 8);
|
||||
else
|
||||
dst[i >> 2] ^= ( src[src_offset + i] & 0x0FF);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Word2Byte(byte[] dst, int dst_offset, int[] src, int srcLen)
|
||||
{
|
||||
int i = 0;
|
||||
int remain = 0;
|
||||
|
||||
for (i = 0; i < srcLen; i++)
|
||||
{
|
||||
remain = i & 3;
|
||||
|
||||
if (remain == 0)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 24);
|
||||
else if (remain == 1)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 16);
|
||||
else if (remain == 2)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 8);
|
||||
else
|
||||
dst[dst_offset + i] = (byte) src[i >> 2];
|
||||
}
|
||||
}
|
||||
|
||||
public int SEED_CCM_Encryption(
|
||||
byte[] ct,
|
||||
byte[] pt, int ptLen,
|
||||
int macLen,
|
||||
byte[] nonce, int nonceLen,
|
||||
byte[] aad, int aadLen,
|
||||
byte[] mKey)
|
||||
{
|
||||
int[] CTR_in = new int[4];
|
||||
int[] CTR_out = new int[4];
|
||||
int[] CBC_in = new int[4];
|
||||
int[] CBC_out = new int[4];
|
||||
int[] MAC = new int[4];
|
||||
int[] tmp = new int[8];
|
||||
int[] rKey = new int[100];
|
||||
int i, flag, tmpLen = 0;
|
||||
gtpa.brs.security.KISA_SEED seed = new gtpa.brs.security.KISA_SEED();
|
||||
|
||||
if (macLen > BLOCK_SIZE_SEED)
|
||||
return 1;
|
||||
|
||||
seed.SEED_KeySched(mKey, rKey);
|
||||
|
||||
Byte2Word(CTR_in, nonce, 0, nonceLen);
|
||||
SHIFTR8(CTR_in);
|
||||
|
||||
flag = 14 - nonceLen;
|
||||
|
||||
CTR_in[0] ^= (flag << 24);
|
||||
|
||||
seed.SEED_Encrypt(MAC, CTR_in, rKey);
|
||||
|
||||
for (i = 0; i < ptLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
INCREASE(CTR_in);
|
||||
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((ptLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(tmp, pt, i, ptLen - i);
|
||||
else
|
||||
Byte2Word(tmp, pt, i, BLOCK_SIZE_SEED);
|
||||
|
||||
seed.SEED_Encrypt(CTR_out, CTR_in, rKey);
|
||||
|
||||
XOR128(tmp, CTR_out, tmp);
|
||||
|
||||
if ((ptLen - i) < BLOCK_SIZE_SEED)
|
||||
Word2Byte(ct, i, tmp, ptLen - i);
|
||||
else
|
||||
Word2Byte(ct, i, tmp, BLOCK_SIZE_SEED);
|
||||
}
|
||||
|
||||
Byte2Word(CBC_in, nonce, 0, nonceLen);
|
||||
SHIFTR8(CBC_in);
|
||||
|
||||
if (aadLen > 0)
|
||||
flag = 0x00000040;
|
||||
else
|
||||
flag = 0x00000000;
|
||||
flag ^= ((macLen - 2) >> 1) << 3;
|
||||
flag ^= 14 - nonceLen;
|
||||
|
||||
CBC_in[0] ^= (flag << 24);
|
||||
CBC_in[3] ^= ptLen;
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
|
||||
if (aadLen > 0)
|
||||
{
|
||||
if (aadLen > 14)
|
||||
tmpLen = 14;
|
||||
else
|
||||
tmpLen = aadLen;
|
||||
|
||||
ZERO128(CBC_in);
|
||||
|
||||
Byte2Word(CBC_in, aad, 0, tmpLen);
|
||||
SHIFTR16(CBC_in);
|
||||
|
||||
CBC_in[0] ^= ((aadLen << 16) & 0xFFFF0000);
|
||||
|
||||
XOR128(CBC_in, CBC_in, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
|
||||
for (i = tmpLen; i < aadLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(CBC_in);
|
||||
|
||||
if ((aadLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(CBC_in, aad, i, aadLen - i);
|
||||
else
|
||||
Byte2Word(CBC_in, aad, i, BLOCK_SIZE_SEED);
|
||||
|
||||
XOR128(CBC_in, CBC_in, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ptLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((ptLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(tmp, pt, i, ptLen - i);
|
||||
else
|
||||
Byte2Word(tmp, pt, i, BLOCK_SIZE_SEED);
|
||||
|
||||
XOR128(CBC_in, tmp, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
}
|
||||
|
||||
XOR128(MAC, MAC, CBC_out);
|
||||
|
||||
Word2Byte(ct, ptLen, MAC, macLen);
|
||||
|
||||
return ptLen + macLen;
|
||||
}
|
||||
|
||||
public int SEED_CCM_Decryption(
|
||||
byte[] pt,
|
||||
byte[] ct, int ctLen,
|
||||
int macLen,
|
||||
byte[] nonce, int nonceLen,
|
||||
byte[] aad, int aadLen,
|
||||
byte[] mKey)
|
||||
{
|
||||
int[] CTR_in = new int[4];
|
||||
int[] CTR_out = new int[4];
|
||||
int[] CBC_in = new int[4];
|
||||
int[] CBC_out = new int[4];
|
||||
int[] MAC = new int[4];
|
||||
byte[] tMAC = new byte[16];
|
||||
int[] tmp = new int[8];
|
||||
int[] rKey = new int[32];
|
||||
int i, j, flag, tmpLen = 0;
|
||||
gtpa.brs.security.KISA_SEED seed = new KISA_SEED();
|
||||
|
||||
if (macLen > BLOCK_SIZE_SEED)
|
||||
return 1;
|
||||
|
||||
seed.SEED_KeySched(mKey, rKey);
|
||||
|
||||
Byte2Word(CTR_in, nonce, 0, nonceLen);
|
||||
SHIFTR8(CTR_in);
|
||||
|
||||
flag = 14 - nonceLen;
|
||||
|
||||
CTR_in[0] ^= (flag << 24);
|
||||
|
||||
seed.SEED_Encrypt(MAC, CTR_in, rKey);
|
||||
|
||||
for (i = 0; i < ctLen - macLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
INCREASE(CTR_in);
|
||||
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((ctLen - macLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(tmp, ct, i, ctLen - macLen - i);
|
||||
else
|
||||
Byte2Word(tmp, ct, i, BLOCK_SIZE_SEED);
|
||||
|
||||
seed.SEED_Encrypt(CTR_out, CTR_in, rKey);
|
||||
|
||||
XOR128(tmp, CTR_out, tmp);
|
||||
|
||||
if ((ctLen - macLen - i) < BLOCK_SIZE_SEED)
|
||||
Word2Byte(pt, i, tmp, ctLen - macLen - i);
|
||||
else
|
||||
Word2Byte(pt, i, tmp, BLOCK_SIZE_SEED);
|
||||
}
|
||||
|
||||
Byte2Word(CBC_in, nonce, 0, nonceLen);
|
||||
SHIFTR8(CBC_in);
|
||||
|
||||
if (aadLen > 0)
|
||||
flag = 0x00000040;
|
||||
else
|
||||
flag = 0x00000000;
|
||||
|
||||
flag ^= ((macLen - 2) >> 1) << 3;
|
||||
flag ^= 14 - nonceLen;
|
||||
|
||||
CBC_in[0] ^= (flag << 24);
|
||||
CBC_in[3] ^= ctLen - macLen;
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
|
||||
if (aadLen > 0)
|
||||
{
|
||||
if (aadLen > 14)
|
||||
tmpLen = 14;
|
||||
else
|
||||
tmpLen = aadLen;
|
||||
|
||||
ZERO128(CBC_in);
|
||||
|
||||
Byte2Word(CBC_in, aad, 0, tmpLen);
|
||||
SHIFTR16(CBC_in);
|
||||
|
||||
CBC_in[0] ^= (aadLen << 16);
|
||||
|
||||
XOR128(CBC_in, CBC_in, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
|
||||
for (i = tmpLen; i < aadLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(CBC_in);
|
||||
|
||||
if ((aadLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(CBC_in, aad, i, aadLen - i);
|
||||
else
|
||||
Byte2Word(CBC_in, aad, i, BLOCK_SIZE_SEED);
|
||||
|
||||
XOR128(CBC_in, CBC_in, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ctLen - macLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((ctLen - macLen - i) < BLOCK_SIZE_SEED)
|
||||
Byte2Word(tmp, pt, i, ctLen - macLen - i);
|
||||
else
|
||||
Byte2Word(tmp, pt, i, BLOCK_SIZE_SEED);
|
||||
|
||||
XOR128(CBC_in, tmp, CBC_out);
|
||||
|
||||
seed.SEED_Encrypt(CBC_out, CBC_in, rKey);
|
||||
}
|
||||
|
||||
XOR128(MAC, MAC, CBC_out);
|
||||
|
||||
Word2Byte(tMAC, 0, MAC, macLen);
|
||||
|
||||
for (i = 0; i < macLen; i++)
|
||||
{
|
||||
if (tMAC[i] != ct[ctLen - macLen + i])
|
||||
{
|
||||
for (j = 0; j < ctLen - macLen; j++)
|
||||
pt[j] = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ctLen - macLen;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,460 @@
|
||||
package gtpa.brs.security;
|
||||
|
||||
import gtpa.brs.security.KISA_SEED;
|
||||
|
||||
public class KISA_SEED_GCM
|
||||
{
|
||||
private static int BLOCK_SIZE_SEED = 16;
|
||||
|
||||
private static void SHIFTR1(int[] R)
|
||||
{
|
||||
R[3] = ((R[3] >> 1) & 0x7FFFFFFF) ^ ((R[2] << 31) & 0x80000000);
|
||||
R[2] = ((R[2] >> 1) & 0x7FFFFFFF) ^ ((R[1] << 31) & 0x80000000);
|
||||
R[1] = ((R[1] >> 1) & 0x7FFFFFFF) ^ ((R[0] << 31) & 0x80000000);
|
||||
R[0] = ((R[0] >> 1) & 0x7FFFFFFF);
|
||||
}
|
||||
|
||||
private static void SHIFTR8(int[] R)
|
||||
{
|
||||
R[3] = ((R[3] >> 8) & 0x00FFFFFF) ^ ((R[2] << 24) & 0xFF000000);
|
||||
R[2] = ((R[2] >> 8) & 0x00FFFFFF) ^ ((R[1] << 24) & 0xFF000000);
|
||||
R[1] = ((R[1] >> 8) & 0x00FFFFFF) ^ ((R[0] << 24) & 0xFF000000);
|
||||
R[0] = ((R[0] >> 8) & 0x00FFFFFF);
|
||||
}
|
||||
|
||||
private static void XOR128(int[] R, int[] A, int[] B)
|
||||
{
|
||||
R[0] = A[0] ^ B[0];
|
||||
R[1] = A[1] ^ B[1];
|
||||
R[2] = A[2] ^ B[2];
|
||||
R[3] = A[3] ^ B[3];
|
||||
}
|
||||
|
||||
private static void INCREASE(int[] ctr)
|
||||
{
|
||||
if (ctr[3] == 0xFFFFFFFF)
|
||||
{
|
||||
ctr[2]++;
|
||||
ctr[3] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctr[3]++;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ZERO128(int[] a) { a[0] = 0x00000000; a[1] = 0x00000000; a[2] = 0x00000000; a[3] = 0x00000000; }
|
||||
|
||||
private static void Byte2Word(int[] dst, byte[] src, int src_offset, int srcLen)
|
||||
{
|
||||
int i = 0;
|
||||
int remain = 0;
|
||||
|
||||
for (i = 0; i < srcLen; i++)
|
||||
{
|
||||
remain = i & 3;
|
||||
|
||||
if (remain == 0)
|
||||
dst[i >> 2] = ((src[src_offset + i] & 0x0FF) << 24);
|
||||
else if (remain == 1)
|
||||
dst[i >> 2] ^= ((src[src_offset + i] & 0x0FF) << 16);
|
||||
else if (remain == 2)
|
||||
dst[i >> 2] ^= ((src[src_offset + i] & 0x0FF) << 8);
|
||||
else
|
||||
dst[i >> 2] ^= ( src[src_offset + i] & 0x0FF);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Word2Byte(byte[] dst, int dst_offset, int[] src, int srcLen)
|
||||
{
|
||||
int i = 0;
|
||||
int remain = 0;
|
||||
|
||||
for (i = 0; i < srcLen; i++)
|
||||
{
|
||||
remain = i & 3;
|
||||
|
||||
if (remain == 0)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 24);
|
||||
else if (remain == 1)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 16);
|
||||
else if (remain == 2)
|
||||
dst[dst_offset + i] = (byte)(src[i >> 2] >> 8);
|
||||
else
|
||||
dst[dst_offset + i] = (byte) src[i >> 2];
|
||||
}
|
||||
}
|
||||
|
||||
private static final int R8[] =
|
||||
{
|
||||
0x00000000, 0x01c20000, 0x03840000, 0x02460000, 0x07080000, 0x06ca0000, 0x048c0000, 0x054e0000,
|
||||
0x0e100000, 0x0fd20000, 0x0d940000, 0x0c560000, 0x09180000, 0x08da0000, 0x0a9c0000, 0x0b5e0000,
|
||||
0x1c200000, 0x1de20000, 0x1fa40000, 0x1e660000, 0x1b280000, 0x1aea0000, 0x18ac0000, 0x196e0000,
|
||||
0x12300000, 0x13f20000, 0x11b40000, 0x10760000, 0x15380000, 0x14fa0000, 0x16bc0000, 0x177e0000,
|
||||
0x38400000, 0x39820000, 0x3bc40000, 0x3a060000, 0x3f480000, 0x3e8a0000, 0x3ccc0000, 0x3d0e0000,
|
||||
0x36500000, 0x37920000, 0x35d40000, 0x34160000, 0x31580000, 0x309a0000, 0x32dc0000, 0x331e0000,
|
||||
0x24600000, 0x25a20000, 0x27e40000, 0x26260000, 0x23680000, 0x22aa0000, 0x20ec0000, 0x212e0000,
|
||||
0x2a700000, 0x2bb20000, 0x29f40000, 0x28360000, 0x2d780000, 0x2cba0000, 0x2efc0000, 0x2f3e0000,
|
||||
0x70800000, 0x71420000, 0x73040000, 0x72c60000, 0x77880000, 0x764a0000, 0x740c0000, 0x75ce0000,
|
||||
0x7e900000, 0x7f520000, 0x7d140000, 0x7cd60000, 0x79980000, 0x785a0000, 0x7a1c0000, 0x7bde0000,
|
||||
0x6ca00000, 0x6d620000, 0x6f240000, 0x6ee60000, 0x6ba80000, 0x6a6a0000, 0x682c0000, 0x69ee0000,
|
||||
0x62b00000, 0x63720000, 0x61340000, 0x60f60000, 0x65b80000, 0x647a0000, 0x663c0000, 0x67fe0000,
|
||||
0x48c00000, 0x49020000, 0x4b440000, 0x4a860000, 0x4fc80000, 0x4e0a0000, 0x4c4c0000, 0x4d8e0000,
|
||||
0x46d00000, 0x47120000, 0x45540000, 0x44960000, 0x41d80000, 0x401a0000, 0x425c0000, 0x439e0000,
|
||||
0x54e00000, 0x55220000, 0x57640000, 0x56a60000, 0x53e80000, 0x522a0000, 0x506c0000, 0x51ae0000,
|
||||
0x5af00000, 0x5b320000, 0x59740000, 0x58b60000, 0x5df80000, 0x5c3a0000, 0x5e7c0000, 0x5fbe0000,
|
||||
0xe1000000, 0xe0c20000, 0xe2840000, 0xe3460000, 0xe6080000, 0xe7ca0000, 0xe58c0000, 0xe44e0000,
|
||||
0xef100000, 0xeed20000, 0xec940000, 0xed560000, 0xe8180000, 0xe9da0000, 0xeb9c0000, 0xea5e0000,
|
||||
0xfd200000, 0xfce20000, 0xfea40000, 0xff660000, 0xfa280000, 0xfbea0000, 0xf9ac0000, 0xf86e0000,
|
||||
0xf3300000, 0xf2f20000, 0xf0b40000, 0xf1760000, 0xf4380000, 0xf5fa0000, 0xf7bc0000, 0xf67e0000,
|
||||
0xd9400000, 0xd8820000, 0xdac40000, 0xdb060000, 0xde480000, 0xdf8a0000, 0xddcc0000, 0xdc0e0000,
|
||||
0xd7500000, 0xd6920000, 0xd4d40000, 0xd5160000, 0xd0580000, 0xd19a0000, 0xd3dc0000, 0xd21e0000,
|
||||
0xc5600000, 0xc4a20000, 0xc6e40000, 0xc7260000, 0xc2680000, 0xc3aa0000, 0xc1ec0000, 0xc02e0000,
|
||||
0xcb700000, 0xcab20000, 0xc8f40000, 0xc9360000, 0xcc780000, 0xcdba0000, 0xcffc0000, 0xce3e0000,
|
||||
0x91800000, 0x90420000, 0x92040000, 0x93c60000, 0x96880000, 0x974a0000, 0x950c0000, 0x94ce0000,
|
||||
0x9f900000, 0x9e520000, 0x9c140000, 0x9dd60000, 0x98980000, 0x995a0000, 0x9b1c0000, 0x9ade0000,
|
||||
0x8da00000, 0x8c620000, 0x8e240000, 0x8fe60000, 0x8aa80000, 0x8b6a0000, 0x892c0000, 0x88ee0000,
|
||||
0x83b00000, 0x82720000, 0x80340000, 0x81f60000, 0x84b80000, 0x857a0000, 0x873c0000, 0x86fe0000,
|
||||
0xa9c00000, 0xa8020000, 0xaa440000, 0xab860000, 0xaec80000, 0xaf0a0000, 0xad4c0000, 0xac8e0000,
|
||||
0xa7d00000, 0xa6120000, 0xa4540000, 0xa5960000, 0xa0d80000, 0xa11a0000, 0xa35c0000, 0xa29e0000,
|
||||
0xb5e00000, 0xb4220000, 0xb6640000, 0xb7a60000, 0xb2e80000, 0xb32a0000, 0xb16c0000, 0xb0ae0000,
|
||||
0xbbf00000, 0xba320000, 0xb8740000, 0xb9b60000, 0xbcf80000, 0xbd3a0000, 0xbf7c0000, 0xbebe0000
|
||||
};
|
||||
|
||||
private static void makeM8(int[][] M, int[] H)
|
||||
{
|
||||
int i = 64, j = 0;
|
||||
int[] temp = new int[4];
|
||||
|
||||
M[128][0] = H[0];
|
||||
M[128][1] = H[1];
|
||||
M[128][2] = H[2];
|
||||
M[128][3] = H[3];
|
||||
|
||||
while (i > 0)
|
||||
{
|
||||
temp[0] = M[i << 1][0];
|
||||
temp[1] = M[i << 1][1];
|
||||
temp[2] = M[i << 1][2];
|
||||
temp[3] = M[i << 1][3];
|
||||
|
||||
if ((temp[3] & 0x01) == 1)
|
||||
{
|
||||
SHIFTR1(temp);
|
||||
temp[0] ^= 0xE1000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
SHIFTR1(temp);
|
||||
}
|
||||
|
||||
M[i][0] = temp[0];
|
||||
M[i][1] = temp[1];
|
||||
M[i][2] = temp[2];
|
||||
M[i][3] = temp[3];
|
||||
|
||||
i >>= 1;
|
||||
}
|
||||
|
||||
i = 2;
|
||||
|
||||
while (i < 256)
|
||||
{
|
||||
for (j = 1; j < i; j++)
|
||||
{
|
||||
M[i + j][0] = M[i][0] ^ M[j][0];
|
||||
M[i + j][1] = M[i][1] ^ M[j][1];
|
||||
M[i + j][2] = M[i][2] ^ M[j][2];
|
||||
M[i + j][3] = M[i][3] ^ M[j][3];
|
||||
}
|
||||
|
||||
i <<= 1;
|
||||
}
|
||||
|
||||
M[0][0] = 0;
|
||||
M[0][1] = 0;
|
||||
M[0][2] = 0;
|
||||
M[0][3] = 0;
|
||||
}
|
||||
|
||||
private static void GHASH_8BIT(int[] out, int[] in, int[][] M, int[] R)
|
||||
{
|
||||
int[] W = new int[4];
|
||||
int[] Z= new int[4];
|
||||
int temp = 0, i = 0;
|
||||
|
||||
XOR128(Z, out, in);
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
temp = ((Z[3 - (i >> 2)] >> ((i & 3) << 3)) & 0x0FF);
|
||||
|
||||
W[0] ^= M[temp][0];
|
||||
W[1] ^= M[temp][1];
|
||||
W[2] ^= M[temp][2];
|
||||
W[3] ^= M[temp][3];
|
||||
|
||||
temp = W[3] & 0x0FF;
|
||||
|
||||
SHIFTR8(W);
|
||||
W[0] ^= R[temp];
|
||||
}
|
||||
|
||||
temp = (Z[0] >> 24) & 0xFF;
|
||||
|
||||
out[0] = W[0] ^ M[temp][0];
|
||||
out[1] = W[1] ^ M[temp][1];
|
||||
out[2] = W[2] ^ M[temp][2];
|
||||
out[3] = W[3] ^ M[temp][3];
|
||||
}
|
||||
|
||||
public int SEED_GCM_Encryption(
|
||||
byte[] ct,
|
||||
byte[] pt, int ptLen,
|
||||
int macLen,
|
||||
byte[] nonce, int nonceLen,
|
||||
byte[] aad, int aadLen,
|
||||
byte[] mKey)
|
||||
{
|
||||
int[] rKey = new int[100];
|
||||
int[] H = new int[4];
|
||||
int[] Z = new int[4];
|
||||
int[] tmp = new int[8];
|
||||
int[] GCTR_in = new int[4];
|
||||
int[] GCTR_out = new int[4];
|
||||
int[] GHASH_in = new int[4];
|
||||
int[] GHASH_out = new int[4];
|
||||
int[][] M8 = new int[256][4];
|
||||
int i = 0;
|
||||
gtpa.brs.security.KISA_SEED seed = new gtpa.brs.security.KISA_SEED();
|
||||
|
||||
if (macLen > 16)
|
||||
return 1;
|
||||
|
||||
seed.SEED_KeySched(mKey, rKey);
|
||||
|
||||
seed.SEED_Encrypt(H, H, rKey);
|
||||
|
||||
makeM8(M8, H);
|
||||
|
||||
if (nonceLen == 12)
|
||||
{
|
||||
Byte2Word(GCTR_in, nonce, 0, nonceLen);
|
||||
|
||||
GCTR_in[3] = 1;
|
||||
|
||||
seed.SEED_Encrypt(Z, GCTR_in, rKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nonceLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((nonceLen - i) < 16)
|
||||
Byte2Word(tmp, nonce, i, nonceLen - i);
|
||||
else
|
||||
Byte2Word(tmp, nonce, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GCTR_in, tmp, M8, R8);
|
||||
}
|
||||
|
||||
ZERO128(tmp);
|
||||
tmp[3] = (nonceLen << 3);
|
||||
|
||||
GHASH_8BIT(GCTR_in, tmp, M8, R8);
|
||||
|
||||
seed.SEED_Encrypt(Z, GCTR_in, rKey);
|
||||
}
|
||||
|
||||
for (i = 0; i < ptLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
INCREASE(GCTR_in);
|
||||
|
||||
seed.SEED_Encrypt(GCTR_out, GCTR_in, rKey);
|
||||
|
||||
if ((ptLen - i) < 16)
|
||||
{
|
||||
Byte2Word(tmp, pt, i, ptLen - i);
|
||||
XOR128(GCTR_out, GCTR_out, tmp);
|
||||
Word2Byte(ct, i, GCTR_out, ptLen - i);
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte2Word(tmp, pt, i, BLOCK_SIZE_SEED);
|
||||
XOR128(GCTR_out, GCTR_out, tmp);
|
||||
Word2Byte(ct, i, GCTR_out, BLOCK_SIZE_SEED);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < aadLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
if ((aadLen - i) < 16)
|
||||
Byte2Word(GHASH_in, aad, i, aadLen - i);
|
||||
else
|
||||
Byte2Word(GHASH_in, aad, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
}
|
||||
|
||||
for (i = 0; i < ptLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
if ((ptLen - i) < 16)
|
||||
Byte2Word(GHASH_in, ct, i, ptLen - i);
|
||||
else
|
||||
Byte2Word(GHASH_in, ct, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
}
|
||||
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
GHASH_in[1] ^= aadLen << 3;
|
||||
GHASH_in[3] ^= ptLen << 3;
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
|
||||
XOR128(GHASH_out, GHASH_out, Z);
|
||||
|
||||
Word2Byte(ct, ptLen, GHASH_out, macLen);
|
||||
|
||||
return ptLen + macLen;
|
||||
}
|
||||
|
||||
public int SEED_GCM_Decryption(
|
||||
byte[] pt,
|
||||
byte[] ct, int ctLen,
|
||||
int macLen,
|
||||
byte[] nonce, int nonceLen,
|
||||
byte[] aad, int aadLen,
|
||||
byte[] mKey)
|
||||
{
|
||||
int[] rKey = new int[100];
|
||||
int[] H = new int[4];
|
||||
int[] Z = new int[4];
|
||||
int[] tmp = new int[8];
|
||||
int[] GCTR_in = new int[4];
|
||||
int[] GCTR_out = new int[4];
|
||||
int[] GHASH_in = new int[4];
|
||||
int[] GHASH_out = new int[4];
|
||||
byte[] MAC = new byte[16];
|
||||
int[][] M8 = new int[256][4];
|
||||
int i = 0, j = 0;
|
||||
gtpa.brs.security.KISA_SEED seed = new KISA_SEED();
|
||||
|
||||
if (macLen > 16)
|
||||
return 1;
|
||||
|
||||
seed.SEED_KeySched(mKey, rKey);
|
||||
|
||||
seed.SEED_Encrypt(H, H, rKey);
|
||||
|
||||
makeM8(M8, H);
|
||||
|
||||
if (nonceLen == 12)
|
||||
{
|
||||
Byte2Word(GCTR_in, nonce, 0, nonceLen);
|
||||
|
||||
GCTR_in[3] = 1;
|
||||
|
||||
seed.SEED_Encrypt(Z, GCTR_in, rKey);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < nonceLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
if ((nonceLen - i) < 16)
|
||||
Byte2Word(tmp, nonce, i, nonceLen - i);
|
||||
else
|
||||
Byte2Word(tmp, nonce, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GCTR_in, tmp, M8, R8);
|
||||
}
|
||||
|
||||
ZERO128(tmp);
|
||||
tmp[3] = (nonceLen << 3);
|
||||
|
||||
GHASH_8BIT(GCTR_in, tmp, M8, R8);
|
||||
|
||||
seed.SEED_Encrypt(Z, GCTR_in, rKey);
|
||||
}
|
||||
|
||||
for (i = 0; i < ctLen - macLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(tmp);
|
||||
|
||||
INCREASE(GCTR_in);
|
||||
|
||||
seed.SEED_Encrypt(GCTR_out, GCTR_in, rKey);
|
||||
|
||||
if ((ctLen - macLen - i) < 16)
|
||||
{
|
||||
Byte2Word(tmp, ct, i, ctLen - macLen - i);
|
||||
XOR128(GCTR_out, GCTR_out, tmp);
|
||||
Word2Byte(pt, i, GCTR_out, ctLen - macLen - i);
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte2Word(tmp, ct, i, BLOCK_SIZE_SEED);
|
||||
XOR128(GCTR_out, GCTR_out, tmp);
|
||||
Word2Byte(pt, i, GCTR_out, BLOCK_SIZE_SEED);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < aadLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
if ((aadLen - i) < 16)
|
||||
Byte2Word(GHASH_in, aad, i, aadLen - i);
|
||||
else
|
||||
Byte2Word(GHASH_in, aad, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
}
|
||||
|
||||
for (i = 0; i < ctLen - macLen; i += BLOCK_SIZE_SEED)
|
||||
{
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
if ((ctLen - macLen - i) < 16)
|
||||
Byte2Word(GHASH_in, ct, i, ctLen - macLen - i);
|
||||
else
|
||||
Byte2Word(GHASH_in, ct, i, BLOCK_SIZE_SEED);
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
}
|
||||
|
||||
ZERO128(GHASH_in);
|
||||
|
||||
GHASH_in[1] = aadLen << 3;
|
||||
GHASH_in[3] = (ctLen - macLen) << 3;
|
||||
|
||||
GHASH_8BIT(GHASH_out, GHASH_in, M8, R8);
|
||||
|
||||
XOR128(GHASH_out, GHASH_out, Z);
|
||||
|
||||
Word2Byte(MAC, 0, GHASH_out, macLen);
|
||||
|
||||
for (i = 0; i < macLen; i++)
|
||||
{
|
||||
if (ct[ctLen - macLen + i] != MAC[i])
|
||||
{
|
||||
for (j = 0; j < ctLen - macLen;j++)
|
||||
pt[j] = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return ctLen - macLen;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,740 @@
|
||||
package gtpa.brs.security;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 18/06/2019
|
||||
* TIME : 10:22 AM
|
||||
* Project : BRSPW
|
||||
* Class : VNOINTEROP
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
import com.sun.crypto.provider.SunJCE;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.NoRouteToHostException;
|
||||
import java.net.Socket;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.Security;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.StringTokenizer;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
@SuppressFBWarnings
|
||||
public class VNOINTEROP {
|
||||
final int PROC_OK = 0;
|
||||
final int AES_SYSTEM_ERR = -1;
|
||||
final int ENC_PROC_ERR = -2;
|
||||
final int ENC_DATA_ERR = -3;
|
||||
final int DEC_PROC_ERR = -4;
|
||||
final int DEC_HASH_ERR = -5;
|
||||
final int DEC_DATA_ERR = -6;
|
||||
final int INPUT_DATA_ERR = -9;
|
||||
final int RECV_DATA_ERR = -21;
|
||||
final int CONNECT_ERR = -31;
|
||||
final int HTTP_SYSTEM_ERR = -34;
|
||||
private String m_strDupInfo = "";
|
||||
private String m_strConnInfo1 = "";
|
||||
private String m_strConnInfo2 = "";
|
||||
private String m_strAGE = "";
|
||||
private String m_strSEX = "";
|
||||
private String m_strBirthDate = "";
|
||||
private String m_strNationalInfo = "";
|
||||
private String m_strEncodeData = "";
|
||||
private String m_strReceiveData = "";
|
||||
private static byte[] mBase64EncMap;
|
||||
private static byte[] mBase64DecMap;
|
||||
static final short HASH_COUNT_MAX = 33;
|
||||
static final short SHARE_KEY_LEN = 16;
|
||||
static final short SHA256_DIGEST_VALUELEN = 32;
|
||||
static final short RETURN_DATA_LEN = 7;
|
||||
static final short LEN_SITE_CODE = 4;
|
||||
static final short LEN_SITE_PASSWORD = 8;
|
||||
static final short LEN_PID = 13;
|
||||
static final short LEN_PID_TYPE = 3;
|
||||
static final byte[] clientKey;
|
||||
|
||||
public VNOINTEROP() {
|
||||
Security.addProvider(new SunJCE());
|
||||
}
|
||||
|
||||
private String base64Encode(byte[] var1) {
|
||||
if (var1 != null && var1.length != 0) {
|
||||
byte[] var2 = new byte[(var1.length + 2) / 3 * 4];
|
||||
int var3 = 0;
|
||||
|
||||
int var4;
|
||||
for(var4 = 0; var3 < var1.length - 2; var3 += 3) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] >>> 2 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] >>> 4 & 15 | var1[var3] << 4 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 2] >>> 6 & 3 | var1[var3 + 1] << 2 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 2] & 63];
|
||||
}
|
||||
|
||||
if (var3 < var1.length) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] >>> 2 & 63];
|
||||
if (var3 < var1.length - 1) {
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] >>> 4 & 15 | var1[var3] << 4 & 63];
|
||||
var2[var4++] = mBase64EncMap[var1[var3 + 1] << 2 & 63];
|
||||
} else {
|
||||
var2[var4++] = mBase64EncMap[var1[var3] << 4 & 63];
|
||||
}
|
||||
}
|
||||
|
||||
while(var4 < var2.length) {
|
||||
var2[var4] = 61;
|
||||
++var4;
|
||||
}
|
||||
|
||||
String var5 = new String(var2);
|
||||
return var5;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can not encode NULL or empty byte array.");
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] base64Decode(String var1) {
|
||||
if (var1 != null && var1.length() != 0) {
|
||||
byte[] var2 = var1.getBytes();
|
||||
|
||||
int var3;
|
||||
for(var3 = var2.length; var2[var3 - 1] == 61; --var3) {
|
||||
;
|
||||
}
|
||||
|
||||
byte[] var4 = new byte[var3 - var2.length / 4];
|
||||
|
||||
int var5;
|
||||
for(var5 = 0; var5 < var2.length; ++var5) {
|
||||
var2[var5] = mBase64DecMap[var2[var5]];
|
||||
}
|
||||
|
||||
var5 = 0;
|
||||
|
||||
int var6;
|
||||
for(var6 = 0; var6 < var4.length - 2; var6 += 3) {
|
||||
var4[var6] = (byte)(var2[var5] << 2 & 255 | var2[var5 + 1] >>> 4 & 3);
|
||||
var4[var6 + 1] = (byte)(var2[var5 + 1] << 4 & 255 | var2[var5 + 2] >>> 2 & 15);
|
||||
var4[var6 + 2] = (byte)(var2[var5 + 2] << 6 & 255 | var2[var5 + 3] & 63);
|
||||
var5 += 4;
|
||||
}
|
||||
|
||||
if (var6 < var4.length) {
|
||||
var4[var6] = (byte)(var2[var5] << 2 & 255 | var2[var5 + 1] >>> 4 & 3);
|
||||
}
|
||||
|
||||
++var6;
|
||||
if (var6 < var4.length) {
|
||||
var4[var6] = (byte)(var2[var5 + 1] << 4 & 255 | var2[var5 + 2] >>> 2 & 15);
|
||||
}
|
||||
|
||||
return var4;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can not decode NULL or empty string.");
|
||||
}
|
||||
}
|
||||
|
||||
public String getDupInfo() {
|
||||
return this.m_strDupInfo;
|
||||
}
|
||||
|
||||
public String getConnInfo() {
|
||||
return this.m_strConnInfo1;
|
||||
}
|
||||
|
||||
public String getConnInfo2() {
|
||||
return this.m_strConnInfo2;
|
||||
}
|
||||
|
||||
public String getAge() {
|
||||
return this.m_strAGE;
|
||||
}
|
||||
|
||||
public String getGender() {
|
||||
return this.m_strSEX;
|
||||
}
|
||||
|
||||
public String getBirthDate() {
|
||||
return this.m_strBirthDate;
|
||||
}
|
||||
|
||||
public String getNationalInfo() {
|
||||
return this.m_strNationalInfo;
|
||||
}
|
||||
|
||||
public int fnRequestDupInfo(String var1, String var2, String var3, String var4) {
|
||||
this.m_strDupInfo = "";
|
||||
this.m_strConnInfo1 = "";
|
||||
this.m_strConnInfo2 = "";
|
||||
this.m_strAGE = "";
|
||||
this.m_strSEX = "";
|
||||
this.m_strBirthDate = "";
|
||||
this.m_strNationalInfo = "";
|
||||
this.m_strEncodeData = "";
|
||||
this.m_strReceiveData = "";
|
||||
boolean var5 = false;
|
||||
if (var1.length() != 4) {
|
||||
return -9;
|
||||
} else if (var2.length() < 8) {
|
||||
return -9;
|
||||
} else if (var3.length() != 13) {
|
||||
return -9;
|
||||
} else if (var4.length() != 3) {
|
||||
return -9;
|
||||
} else if (!var4.equals("JID") && !var4.equals("SID") && !var4.equals("SNC") && !var4.equals("VNO")) {
|
||||
return -9;
|
||||
} else {
|
||||
int var6 = this.fnEncode(var3, var2);
|
||||
if (var6 != 0) {
|
||||
return var6;
|
||||
} else {
|
||||
var6 = this.fnHTTPConn(var1, var4, "", this.m_strEncodeData, var4.equals("SNC"));
|
||||
if (var6 != 0) {
|
||||
return var6;
|
||||
} else {
|
||||
var6 = this.fnDecode(this.m_strReceiveData, "");
|
||||
return var6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int fnRequestConnInfo(String var1, String var2, String var3, String var4) {
|
||||
return this.fnRequestConnInfo(var1, var2, var3, var4, "CI1");
|
||||
}
|
||||
|
||||
public int fnRequestConnInfo(String var1, String var2, String var3, String var4, String var5) {
|
||||
this.m_strDupInfo = "";
|
||||
this.m_strConnInfo1 = "";
|
||||
this.m_strConnInfo2 = "";
|
||||
this.m_strAGE = "";
|
||||
this.m_strSEX = "";
|
||||
this.m_strBirthDate = "";
|
||||
this.m_strNationalInfo = "";
|
||||
this.m_strEncodeData = "";
|
||||
this.m_strReceiveData = "";
|
||||
boolean var6 = false;
|
||||
if (var1.length() != 4) {
|
||||
return -9;
|
||||
} else if (var2.length() < 8) {
|
||||
return -9;
|
||||
} else if (var3.length() != 13) {
|
||||
return -9;
|
||||
} else if (var4.length() != 3) {
|
||||
return -9;
|
||||
} else if (!var4.equals("JID") && !var4.equals("SID") && !var4.equals("SNC") && !var4.equals("VNO")) {
|
||||
return -9;
|
||||
} else {
|
||||
int var7 = this.fnEncode(var3, var2);
|
||||
if (var7 != 0) {
|
||||
return var7;
|
||||
} else {
|
||||
var7 = this.fnHTTPConn(var1, var4, var5, this.m_strEncodeData, var4.equals("SNC"));
|
||||
if (var7 != 0) {
|
||||
return var7;
|
||||
} else {
|
||||
var7 = this.fnDecode(this.m_strReceiveData, var5);
|
||||
return var7;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int fnDecode(String var1, String var2) {
|
||||
int var3 = 0;
|
||||
boolean var4 = false;
|
||||
boolean var5 = false;
|
||||
boolean var6 = false;
|
||||
boolean var7 = false;
|
||||
int var8 = 0;
|
||||
StringTokenizer var9 = null;
|
||||
new StringBuffer();
|
||||
String[] var11 = null;
|
||||
Object var12 = null;
|
||||
Object var13 = null;
|
||||
byte[] var14 = null;
|
||||
Object var15 = null;
|
||||
Object var16 = null;
|
||||
Object var17 = null;
|
||||
String var18 = "";
|
||||
String var19 = "";
|
||||
String var20 = "";
|
||||
MessageDigest var21 = null;
|
||||
Object var22 = null;
|
||||
Object var23 = null;
|
||||
|
||||
try {
|
||||
byte[] var32 = this.base64Decode(var1);
|
||||
|
||||
int var28;
|
||||
for(var28 = 0; var28 < var32.length; ++var28) {
|
||||
if (var32[var28] == 95) {
|
||||
++var8;
|
||||
if (var8 == 2) {
|
||||
++var28;
|
||||
var8 = var28;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
byte[] var31 = new byte[var8];
|
||||
|
||||
for(var28 = 0; var28 < var8; ++var28) {
|
||||
var31[var28] = var32[var28];
|
||||
}
|
||||
|
||||
var18 = new String(var31);
|
||||
var9 = new StringTokenizer(var18, "_");
|
||||
if (var9.countTokens() < 2) {
|
||||
return -6;
|
||||
}
|
||||
|
||||
var19 = var9.nextToken();
|
||||
if (!this.checkNumber(var19)) {
|
||||
return -6;
|
||||
}
|
||||
|
||||
int var29 = Integer.parseInt(var19);
|
||||
var19 = var9.nextToken();
|
||||
if (!this.checkNumber(var19)) {
|
||||
return -6;
|
||||
}
|
||||
|
||||
int var30 = Integer.parseInt(var19);
|
||||
var18 = "" + var29 + "_" + var30 + "_";
|
||||
if (var32.length < var8 + 32) {
|
||||
return -6;
|
||||
}
|
||||
|
||||
if (var32.length > var8 + 32) {
|
||||
byte[] var33 = clientKey;
|
||||
var21 = MessageDigest.getInstance("SHA-256");
|
||||
|
||||
for(var28 = 0; var28 < var29; ++var28) {
|
||||
var21.reset();
|
||||
var21.update(var33);
|
||||
var14 = var21.digest();
|
||||
var33 = var14;
|
||||
}
|
||||
|
||||
byte[] var36 = new byte[16];
|
||||
byte[] var37 = new byte[16];
|
||||
|
||||
for(var28 = 0; var28 < 16; ++var28) {
|
||||
var36[var28] = var33[var28];
|
||||
var37[var28] = var33[16 + var28];
|
||||
}
|
||||
|
||||
int var27 = var8;
|
||||
|
||||
for(var28 = 0; var28 < 32; ++var28) {
|
||||
var14[var28] = var32[var27 + var28];
|
||||
}
|
||||
|
||||
var27 += 32;
|
||||
byte[] var34 = new byte[var32.length - var27];
|
||||
|
||||
for(var28 = 0; var28 < var32.length - var27; ++var28) {
|
||||
var34[var28] = var32[var27 + var28];
|
||||
}
|
||||
|
||||
SecretKeySpec var24 = new SecretKeySpec(var36, "AES");
|
||||
Cipher var25 = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
|
||||
var25.init(2, var24, new IvParameterSpec(var37));
|
||||
var32 = var25.doFinal(var34);
|
||||
var20 = new String(var32, "euc-kr");
|
||||
var21.reset();
|
||||
var21.update(var20.getBytes());
|
||||
byte[] var35 = var21.digest();
|
||||
|
||||
for(var28 = 0; var28 < 32; ++var28) {
|
||||
if (var35[var28] != var14[var28]) {
|
||||
return -5;
|
||||
}
|
||||
}
|
||||
|
||||
var11 = var20.split("\\^", 7);
|
||||
var19 = var11[1];
|
||||
if (this.checkNumber(var19)) {
|
||||
var3 = Integer.parseInt(var19);
|
||||
if (var11.length >= 3) {
|
||||
if (var2.equals("CI1")) {
|
||||
this.m_strConnInfo1 = var11[2];
|
||||
} else if (var2.equals("CI2")) {
|
||||
this.m_strConnInfo2 = var11[2];
|
||||
} else if (var2.equals("ALL")) {
|
||||
this.m_strDupInfo = var11[2];
|
||||
this.m_strConnInfo1 = var11[3];
|
||||
} else {
|
||||
this.m_strDupInfo = var11[2];
|
||||
}
|
||||
|
||||
if (var11.length >= 7) {
|
||||
if (var2.equals("ALL")) {
|
||||
this.m_strAGE = var11[4];
|
||||
this.m_strSEX = var11[5];
|
||||
this.m_strBirthDate = var11[6];
|
||||
this.m_strNationalInfo = var11[7];
|
||||
} else {
|
||||
this.m_strAGE = var11[3];
|
||||
this.m_strSEX = var11[4];
|
||||
this.m_strBirthDate = var11[5];
|
||||
this.m_strNationalInfo = var11[6];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var3 = -6;
|
||||
}
|
||||
}
|
||||
} catch (Exception var26) {
|
||||
var3 = -4;
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
private int fnEncode(String var1, String var2) {
|
||||
this.m_strEncodeData = "";
|
||||
byte var3 = 0;
|
||||
boolean var4 = false;
|
||||
boolean var5 = false;
|
||||
int var6 = (int)(Math.random() * 33.0D) + 1;
|
||||
Date var7 = new Date(System.currentTimeMillis());
|
||||
SimpleDateFormat var8 = new SimpleDateFormat("yyMMddHHmmss");
|
||||
String var9 = var8.format(var7);
|
||||
StringBuffer var10 = new StringBuffer();
|
||||
String var11 = "";
|
||||
Object var12 = null;
|
||||
Object var13 = null;
|
||||
Object var14 = null;
|
||||
Object var15 = null;
|
||||
Object var16 = null;
|
||||
MessageDigest var17 = null;
|
||||
Object var18 = null;
|
||||
Object var19 = null;
|
||||
|
||||
try {
|
||||
byte[] var27 = clientKey;
|
||||
var17 = MessageDigest.getInstance("SHA-256");
|
||||
|
||||
int var23;
|
||||
byte[] var26;
|
||||
for(var23 = 0; var23 < var6; ++var23) {
|
||||
var17.reset();
|
||||
var17.update(var27);
|
||||
var26 = var17.digest();
|
||||
var27 = var26;
|
||||
}
|
||||
|
||||
byte[] var31 = new byte[16];
|
||||
byte[] var32 = new byte[16];
|
||||
|
||||
for(var23 = 0; var23 < 16; ++var23) {
|
||||
var31[var23] = var27[var23];
|
||||
var32[var23] = var27[16 + var23];
|
||||
}
|
||||
|
||||
var10.append(var9);
|
||||
var10.append("^");
|
||||
var10.append(var1);
|
||||
var10.append("^");
|
||||
var10.append(var2);
|
||||
SecretKeySpec var20 = new SecretKeySpec(var31, "AES");
|
||||
Cipher var21 = Cipher.getInstance("AES/CBC/PKCS5Padding", "SunJCE");
|
||||
var21.init(1, var20, new IvParameterSpec(var32));
|
||||
byte[] var28 = var21.doFinal(var10.toString().getBytes());
|
||||
int var24 = var28.length;
|
||||
if (var24 <= 0) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
var17.reset();
|
||||
var17.update(var10.toString().getBytes());
|
||||
var26 = var17.digest();
|
||||
var11 = "" + var6 + "_" + var10.toString().getBytes().length + "_";
|
||||
byte[] var30 = var11.getBytes();
|
||||
var6 = var11.length() + 32 + var24;
|
||||
byte[] var29 = new byte[var6];
|
||||
byte var25 = 0;
|
||||
|
||||
for(var23 = 0; var23 < var11.length(); ++var23) {
|
||||
var29[var25 + var23] = var30[var23];
|
||||
}
|
||||
|
||||
var6 = var25 + var11.length();
|
||||
|
||||
for(var23 = 0; var23 < 32; ++var23) {
|
||||
var29[var6 + var23] = var26[var23];
|
||||
}
|
||||
|
||||
var6 += 32;
|
||||
|
||||
for(var23 = 0; var23 < var24; ++var23) {
|
||||
var29[var6 + var23] = var28[var23];
|
||||
}
|
||||
|
||||
this.m_strEncodeData = this.base64Encode(var29);
|
||||
} catch (Exception var22) {
|
||||
var22.printStackTrace();
|
||||
var3 = -2;
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
private boolean checkNumber(String var1) {
|
||||
int var2 = var1.length();
|
||||
boolean var3 = false;
|
||||
|
||||
for(int var4 = 0; var4 < var2; ++var4) {
|
||||
char var5 = var1.charAt(var4);
|
||||
if (var5 < '0' || var5 > '9') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getRandom() {
|
||||
return Math.abs((new Long(System.currentTimeMillis())).intValue());
|
||||
}
|
||||
|
||||
private int fnHTTPConn(String var1, String var2, String var3, String var4, boolean var5) {
|
||||
this.m_strReceiveData = "";
|
||||
boolean var6 = false;
|
||||
Socket var7 = null;
|
||||
InputStream var8 = null;
|
||||
PrintWriter var9 = null;
|
||||
|
||||
byte var69;
|
||||
try {
|
||||
int var10 = this.getRandom();
|
||||
//String var11 = var5 ? "http://203.234.219.72/snc2vno_interop.asp" : "http://203.234.219.72/cvm_interop.asp";
|
||||
String var11 = var5 ? "http://175.193.201.51/snc2vno_interop.asp" : "http://175.193.201.51/cvm_interop.asp";
|
||||
URL var12 = new URL(var11.toString());
|
||||
String var13 = var12.getHost();
|
||||
int var14 = 81 + var10 % 5;
|
||||
//var14 = 80;
|
||||
String var15 = var12.getFile();
|
||||
var7 = new Socket();
|
||||
var7.connect(new InetSocketAddress(var13, 80), 3000);
|
||||
var7.setSoTimeout(3000);
|
||||
var9 = new PrintWriter(var7.getOutputStream(), false);
|
||||
var8 = var7.getInputStream();
|
||||
StringBuffer var16 = new StringBuffer();
|
||||
var16.append(URLEncoder.encode("p1", "euc-kr") + "=" + URLEncoder.encode(var1, "euc-kr") + "&");
|
||||
var16.append(URLEncoder.encode("p2", "euc-kr") + "=" + URLEncoder.encode(var4, "euc-kr") + "&");
|
||||
var16.append(URLEncoder.encode("p3", "euc-kr") + "=" + URLEncoder.encode(var2, "euc-kr") + "&");
|
||||
var16.append(URLEncoder.encode("p4", "euc-kr") + "=" + URLEncoder.encode(var3, "euc-kr"));
|
||||
int var17 = var16.toString().length();
|
||||
StringBuffer var18 = new StringBuffer();
|
||||
var18.append("POST " + var15 + " HTTP/1.1\n");
|
||||
var18.append("Accept: */*\n");
|
||||
var18.append("Connection: close\n");
|
||||
//var18.append("Host: wtname.creditbank.co.kr\n");
|
||||
var18.append("Host: " + var13 + ":" + var14 + "\n");
|
||||
var18.append("Content-Type: application/x-www-form-urlencoded\n");
|
||||
var18.append("Content-Length: " + var17 + "\r\n");
|
||||
var18.append("\r\n");
|
||||
var18.append(var16.toString());
|
||||
var9.print(var18.toString());
|
||||
var9.flush();
|
||||
var18.setLength(0);
|
||||
int var19 = 0;
|
||||
|
||||
boolean var20;
|
||||
for(var20 = true; var20 && var19 != -1; var20 = (var19 = var8.read()) == 73 ? ((var19 = var8.read()) == 78 ? ((var19 = var8.read()) == 84 ? ((var19 = var8.read()) == 69 ? ((var19 = var8.read()) == 82 ? ((var19 = var8.read()) == 79 ? ((var19 = var8.read()) == 80 ? ((var19 = var8.read()) == 95 ? ((var19 = var8.read()) == 82 ? ((var19 = var8.read()) == 84 ? ((var19 = var8.read()) == 78 ? (var19 = var8.read()) != 61 : true) : true) : true) : true) : true) : true) : true) : true) : true) : true) : true) {
|
||||
;
|
||||
}
|
||||
|
||||
if (var20 && var19 == -1) {
|
||||
var69 = -21;
|
||||
this.m_strReceiveData = "";
|
||||
} else {
|
||||
byte[] var21 = new byte[1024];
|
||||
var8.read(var21);
|
||||
this.m_strReceiveData = (new String(var21)).toString().trim();
|
||||
var69 = 0;
|
||||
}
|
||||
|
||||
var9.close();
|
||||
var8.close();
|
||||
var7.close();
|
||||
var7 = null;
|
||||
var8 = null;
|
||||
var9 = null;
|
||||
} catch (MalformedURLException var65) {
|
||||
if (var9 != null) {
|
||||
try {
|
||||
var9.close();
|
||||
var9 = null;
|
||||
} catch (Exception var64) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var8 != null) {
|
||||
try {
|
||||
var8.close();
|
||||
var8 = null;
|
||||
} catch (Exception var63) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var7 != null) {
|
||||
try {
|
||||
var7.close();
|
||||
var7 = null;
|
||||
} catch (Exception var62) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
var69 = -31;
|
||||
} catch (NoRouteToHostException var66) {
|
||||
if (var9 != null) {
|
||||
try {
|
||||
var9.close();
|
||||
var9 = null;
|
||||
} catch (Exception var61) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var8 != null) {
|
||||
try {
|
||||
var8.close();
|
||||
var8 = null;
|
||||
} catch (Exception var60) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var7 != null) {
|
||||
try {
|
||||
var7.close();
|
||||
var7 = null;
|
||||
} catch (Exception var59) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
var69 = -31;
|
||||
} catch (Exception var67) {
|
||||
var67.printStackTrace();
|
||||
if (var9 != null) {
|
||||
try {
|
||||
var9.close();
|
||||
var9 = null;
|
||||
} catch (Exception var58) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var8 != null) {
|
||||
try {
|
||||
var8.close();
|
||||
var8 = null;
|
||||
} catch (Exception var57) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var7 != null) {
|
||||
try {
|
||||
var7.close();
|
||||
var7 = null;
|
||||
} catch (Exception var56) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
var69 = -34;
|
||||
} finally {
|
||||
if (var9 != null) {
|
||||
try {
|
||||
var9.close();
|
||||
var9 = null;
|
||||
} catch (Exception var55) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var8 != null) {
|
||||
try {
|
||||
var8.close();
|
||||
var8 = null;
|
||||
} catch (Exception var54) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
if (var7 != null) {
|
||||
try {
|
||||
var7.close();
|
||||
var7 = null;
|
||||
} catch (Exception var53) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return var69;
|
||||
}
|
||||
|
||||
public static String[] split(String var0, String var1) {
|
||||
int var2 = 0;
|
||||
int var3 = 0;
|
||||
int var4 = 0;
|
||||
boolean var5 = false;
|
||||
|
||||
do {
|
||||
++var2;
|
||||
++var3;
|
||||
var3 = var0.indexOf(var1, var3);
|
||||
} while(var3 != -1);
|
||||
|
||||
String[] var6 = new String[var2];
|
||||
|
||||
for(var3 = 0; var4 < var2; ++var4) {
|
||||
int var7 = var0.indexOf(var1, var3);
|
||||
if (var7 == -1) {
|
||||
var6[var4] = var0.substring(var3).trim();
|
||||
} else {
|
||||
var6[var4] = var0.substring(var3, var7).trim();
|
||||
}
|
||||
|
||||
var3 = var7 + 1;
|
||||
}
|
||||
|
||||
return var6;
|
||||
}
|
||||
|
||||
static {
|
||||
byte[] var0 = new byte[]{65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 47};
|
||||
mBase64EncMap = var0;
|
||||
mBase64DecMap = new byte[128];
|
||||
|
||||
for(int var1 = 0; var1 < mBase64EncMap.length; ++var1) {
|
||||
mBase64DecMap[mBase64EncMap[var1]] = (byte)var1;
|
||||
}
|
||||
|
||||
clientKey = new byte[]{-126, 120, -11, -107, 16, -63, 66, 127, -31, -109, -122, 67, -97, 85, -85, -60};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package gtpa.brs.user.dto;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 12/04/2019
|
||||
* TIME : 4:04 PM
|
||||
* Project : BRSPW
|
||||
* Class : TempCarInfo
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public class TempBankInfo {
|
||||
//결제수단
|
||||
String payOrd;
|
||||
String payType;
|
||||
String payComp;
|
||||
String payName;
|
||||
String payKey;
|
||||
|
||||
public String getPayOrd() {
|
||||
return payOrd;
|
||||
}
|
||||
|
||||
public void setPayOrd(String payOrd) {
|
||||
this.payOrd = payOrd;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getPayComp() {
|
||||
return payComp;
|
||||
}
|
||||
|
||||
public void setPayComp(String payComp) {
|
||||
this.payComp = payComp;
|
||||
}
|
||||
|
||||
public String getPayName() {
|
||||
return payName;
|
||||
}
|
||||
|
||||
public void setPayName(String payName) {
|
||||
this.payName = payName;
|
||||
}
|
||||
|
||||
public String getPayKey() {
|
||||
return payKey;
|
||||
}
|
||||
|
||||
public void setPayKey(String payKey) {
|
||||
this.payKey = payKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("TempPayInfo{");
|
||||
sb.append("payOrd='").append(payOrd).append('\'');
|
||||
sb.append(", payType='").append(payType).append('\'');
|
||||
sb.append(", payComp='").append(payComp).append('\'');
|
||||
sb.append(", payName='").append(payName).append('\'');
|
||||
sb.append(", payKey='").append(payKey).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package gtpa.brs.user.dto;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 12/04/2019
|
||||
* TIME : 4:04 PM
|
||||
* Project : BRSPW
|
||||
* Class : TempCarInfo
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public class TempCarInfo {
|
||||
//차량정보
|
||||
String mberNo = "";
|
||||
String vhcleManageNo = "";
|
||||
String vhclePosesnTy= "";
|
||||
String vhcleNo= "";
|
||||
String vhcleOwnerCi= "";
|
||||
String useBeginDt= "";
|
||||
String useEndDt= "";
|
||||
String vhcleSttusTy= "";
|
||||
String setleAgreTy= "";
|
||||
String penaltyAgreTy= "";
|
||||
|
||||
public String getMberNo() {
|
||||
return mberNo;
|
||||
}
|
||||
|
||||
public void setMberNo(String mberNo) {
|
||||
this.mberNo = mberNo;
|
||||
}
|
||||
|
||||
public String getVhcleManageNo() {
|
||||
return vhcleManageNo;
|
||||
}
|
||||
|
||||
public void setVhcleManageNo(String vhcleManageNo) {
|
||||
this.vhcleManageNo = vhcleManageNo;
|
||||
}
|
||||
|
||||
public String getVhclePosesnTy() {
|
||||
return vhclePosesnTy;
|
||||
}
|
||||
|
||||
public void setVhclePosesnTy(String vhclePosesnTy) {
|
||||
this.vhclePosesnTy = vhclePosesnTy;
|
||||
}
|
||||
|
||||
public String getVhcleNo() {
|
||||
return vhcleNo;
|
||||
}
|
||||
|
||||
public void setVhcleNo(String vhcleNo) {
|
||||
this.vhcleNo = vhcleNo;
|
||||
}
|
||||
|
||||
public String getVhcleOwnerCi() {
|
||||
return vhcleOwnerCi;
|
||||
}
|
||||
|
||||
public void setVhcleOwnerCi(String vhcleOwnerCi) {
|
||||
this.vhcleOwnerCi = vhcleOwnerCi;
|
||||
}
|
||||
|
||||
public String getUseBeginDt() {
|
||||
return useBeginDt;
|
||||
}
|
||||
|
||||
public void setUseBeginDt(String useBeginDt) {
|
||||
this.useBeginDt = useBeginDt;
|
||||
}
|
||||
|
||||
public String getUseEndDt() {
|
||||
return useEndDt;
|
||||
}
|
||||
|
||||
public void setUseEndDt(String useEndDt) {
|
||||
this.useEndDt = useEndDt;
|
||||
}
|
||||
|
||||
public String getVhcleSttusTy() {
|
||||
return vhcleSttusTy;
|
||||
}
|
||||
|
||||
public void setVhcleSttusTy(String vhcleSttusTy) {
|
||||
this.vhcleSttusTy = vhcleSttusTy;
|
||||
}
|
||||
|
||||
public String getSetleAgreTy() {
|
||||
return setleAgreTy;
|
||||
}
|
||||
|
||||
public void setSetleAgreTy(String setleAgreTy) {
|
||||
this.setleAgreTy = setleAgreTy;
|
||||
}
|
||||
|
||||
public String getPenaltyAgreTy() {
|
||||
return penaltyAgreTy;
|
||||
}
|
||||
|
||||
public void setPenaltyAgreTy(String penaltyAgreTy) {
|
||||
this.penaltyAgreTy = penaltyAgreTy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("TempCarInfo{");
|
||||
sb.append("mberNo='").append(mberNo).append('\'');
|
||||
sb.append(", vhcleManageNo='").append(vhcleManageNo).append('\'');
|
||||
sb.append(", vhclePosesnTy='").append(vhclePosesnTy).append('\'');
|
||||
sb.append(", vhcleNo='").append(vhcleNo).append('\'');
|
||||
sb.append(", vhcleOwnerCi='").append(vhcleOwnerCi).append('\'');
|
||||
sb.append(", useBeginDt='").append(useBeginDt).append('\'');
|
||||
sb.append(", useEndDt='").append(useEndDt).append('\'');
|
||||
sb.append(", vhcleSttusTy='").append(vhcleSttusTy).append('\'');
|
||||
sb.append(", setleAgreTy='").append(setleAgreTy).append('\'');
|
||||
sb.append(", penaltyAgreTy='").append(penaltyAgreTy).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package gtpa.brs.user.dto;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 12/04/2019
|
||||
* TIME : 4:04 PM
|
||||
* Project : BRSPW
|
||||
* Class : TempCarInfo
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public class TempCreditInfo {
|
||||
//결제수단
|
||||
String payOrd;
|
||||
String payType;
|
||||
String payComp;
|
||||
String payName;
|
||||
String payKey;
|
||||
|
||||
public String getPayOrd() {
|
||||
return payOrd;
|
||||
}
|
||||
|
||||
public void setPayOrd(String payOrd) {
|
||||
this.payOrd = payOrd;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getPayComp() {
|
||||
return payComp;
|
||||
}
|
||||
|
||||
public void setPayComp(String payComp) {
|
||||
this.payComp = payComp;
|
||||
}
|
||||
|
||||
public String getPayName() {
|
||||
return payName;
|
||||
}
|
||||
|
||||
public void setPayName(String payName) {
|
||||
this.payName = payName;
|
||||
}
|
||||
|
||||
public String getPayKey() {
|
||||
return payKey;
|
||||
}
|
||||
|
||||
public void setPayKey(String payKey) {
|
||||
this.payKey = payKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("TempPayInfo{");
|
||||
sb.append("payOrd='").append(payOrd).append('\'');
|
||||
sb.append(", payType='").append(payType).append('\'');
|
||||
sb.append(", payComp='").append(payComp).append('\'');
|
||||
sb.append(", payName='").append(payName).append('\'');
|
||||
sb.append(", payKey='").append(payKey).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package gtpa.brs.user.dto;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 12/04/2019
|
||||
* TIME : 4:04 PM
|
||||
* Project : BRSPW
|
||||
* Class : TempCarInfo
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
public class TempPayInfo {
|
||||
//결제수단
|
||||
String payOrd;
|
||||
String payType;
|
||||
String payComp;
|
||||
String payName;
|
||||
String payKey;
|
||||
|
||||
public String getPayOrd() {
|
||||
return payOrd;
|
||||
}
|
||||
|
||||
public void setPayOrd(String payOrd) {
|
||||
this.payOrd = payOrd;
|
||||
}
|
||||
|
||||
public String getPayType() {
|
||||
return payType;
|
||||
}
|
||||
|
||||
public void setPayType(String payType) {
|
||||
this.payType = payType;
|
||||
}
|
||||
|
||||
public String getPayComp() {
|
||||
return payComp;
|
||||
}
|
||||
|
||||
public void setPayComp(String payComp) {
|
||||
this.payComp = payComp;
|
||||
}
|
||||
|
||||
public String getPayName() {
|
||||
return payName;
|
||||
}
|
||||
|
||||
public void setPayName(String payName) {
|
||||
this.payName = payName;
|
||||
}
|
||||
|
||||
public String getPayKey() {
|
||||
return payKey;
|
||||
}
|
||||
|
||||
public void setPayKey(String payKey) {
|
||||
this.payKey = payKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuffer sb = new StringBuffer("TempPayInfo{");
|
||||
sb.append("payOrd='").append(payOrd).append('\'');
|
||||
sb.append(", payType='").append(payType).append('\'');
|
||||
sb.append(", payComp='").append(payComp).append('\'');
|
||||
sb.append(", payName='").append(payName).append('\'');
|
||||
sb.append(", payKey='").append(payKey).append('\'');
|
||||
sb.append('}');
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,515 @@
|
||||
package gtpa.brs.user.dto;
|
||||
|
||||
import gtpa.brs.util.SHA256Util;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.context.annotation.ScopedProxyMode;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* /////////////////////////////////////////////////////
|
||||
* Company : MQNIC
|
||||
* Create : seunghyun
|
||||
* Date : 12/04/2019
|
||||
* TIME : 10:25 AM
|
||||
* Project : BRSPW
|
||||
* Class : TempUserSessionDTO
|
||||
* Desc :
|
||||
* /////////////////////////////////////////////////////
|
||||
*/
|
||||
@Component
|
||||
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
|
||||
public class TempUserSessionInfoDTO implements Serializable {
|
||||
|
||||
Date makeTime;
|
||||
// 회원정보
|
||||
public String mberNo;
|
||||
public String mberId;
|
||||
public String mberty;
|
||||
public String mberPw;
|
||||
public String mberNm;
|
||||
public String mberCi;
|
||||
public String mberMobileNo;
|
||||
public String mberBirthDt;
|
||||
public String infoProvdAgreAt;
|
||||
public String tunnelFeeAgreAt;
|
||||
public String parkFeeAgreAt;
|
||||
public String jmpTunnelFeeAgreAt;
|
||||
public String ssmTunnelFeeAgreAt;
|
||||
public String tunnelPenaltyAgreAt;
|
||||
public String penaltyAgreAt;
|
||||
public String trnsitDscntAt;
|
||||
public String mnychRdcxptAt;
|
||||
public String childrenCnt;
|
||||
public String childrenBirthday;
|
||||
public String serviceResult;
|
||||
public String mnychRdcxptVhcle;
|
||||
public String athzerAt;
|
||||
public String resName;
|
||||
public String relCd;
|
||||
public String authoriPsnYn;
|
||||
public String subjKbnCd;
|
||||
public String wondClassCd;
|
||||
public String inquRsltCd;
|
||||
|
||||
// 사업자정보
|
||||
public String entrprsNm ;
|
||||
public String bsnmRegistNo;
|
||||
public String cprRegistNo;
|
||||
public String chargerNm;
|
||||
public String chargerCi;
|
||||
public String chargerMobileNo;
|
||||
|
||||
public Map tempUserInfo;
|
||||
public List<Map> tempCarInfos;
|
||||
public List<Map> tempCreditInfos;
|
||||
public List<Map> tempBankInfos;
|
||||
public Map mnychRdcxpt;
|
||||
|
||||
//약관동의
|
||||
public String termsCheck1;
|
||||
public String termsCheck2;
|
||||
public String termsCheck3;
|
||||
public String termsCheck4;
|
||||
public String termsCheck5;
|
||||
|
||||
//문자인증키
|
||||
public String phoneNum;
|
||||
public String smsKey;
|
||||
|
||||
public TempUserSessionInfoDTO() {
|
||||
this.makeTime = new Date();
|
||||
}
|
||||
|
||||
public long getMakeTime() {
|
||||
return makeTime.getTime();
|
||||
}
|
||||
|
||||
public Map getTempUserInfo() {
|
||||
return tempUserInfo;
|
||||
}
|
||||
|
||||
public void setTempUserInfo(Map tempUserInfo) {
|
||||
this.tempUserInfo = tempUserInfo;
|
||||
}
|
||||
|
||||
public Map getMnychRdcxpt() {
|
||||
return mnychRdcxpt;
|
||||
}
|
||||
|
||||
public void setMnychRdcxpt(Map mnychRdcxpt) {
|
||||
this.mnychRdcxpt = mnychRdcxpt;
|
||||
}
|
||||
|
||||
public String getMberNo() {
|
||||
return mberNo;
|
||||
}
|
||||
|
||||
public void setMberNo(String mberNo) {
|
||||
this.mberNo = mberNo;
|
||||
}
|
||||
|
||||
public String getMberId() {
|
||||
return mberId;
|
||||
}
|
||||
|
||||
public void setMberId(String mberId) {
|
||||
this.mberId = mberId;
|
||||
}
|
||||
|
||||
public String getMberty() {
|
||||
return mberty;
|
||||
}
|
||||
|
||||
public void setMberty(String mberty) {
|
||||
this.mberty = mberty;
|
||||
}
|
||||
|
||||
public String getMberPw() {
|
||||
return mberPw;
|
||||
}
|
||||
|
||||
public void setMberPw(String mberPw) {
|
||||
this.mberPw = SHA256Util.encryptSHA256(mberPw);
|
||||
}
|
||||
|
||||
public String getMberNm() {
|
||||
return mberNm;
|
||||
}
|
||||
|
||||
public void setMberNm(String mberNm) {
|
||||
this.mberNm = mberNm;
|
||||
}
|
||||
|
||||
public String getMberCi() {
|
||||
return mberCi;
|
||||
}
|
||||
|
||||
public void setMberCi(String mberCi) {
|
||||
this.mberCi = mberCi;
|
||||
}
|
||||
|
||||
public String getMberMobileNo() {
|
||||
return mberMobileNo;
|
||||
}
|
||||
|
||||
public void setMberMobileNo(String mberMobileNo) {
|
||||
this.mberMobileNo = mberMobileNo;
|
||||
}
|
||||
|
||||
public String getMberBirthDt() {
|
||||
return mberBirthDt;
|
||||
}
|
||||
|
||||
public void setMberBirthDt(String mberBirthDt) {
|
||||
this.mberBirthDt = mberBirthDt;
|
||||
}
|
||||
|
||||
public String getTrnsitDscntAt() {
|
||||
return trnsitDscntAt;
|
||||
}
|
||||
|
||||
public void setTrnsitDscntAt(String trnsitDscntAt) {
|
||||
this.trnsitDscntAt = trnsitDscntAt;
|
||||
}
|
||||
|
||||
public String getMnychRdcxptAt() {
|
||||
return mnychRdcxptAt;
|
||||
}
|
||||
|
||||
public void setMnychRdcxptAt(String mnychRdcxptAt) {
|
||||
this.mnychRdcxptAt = mnychRdcxptAt;
|
||||
}
|
||||
|
||||
public String getChildrenCnt() {
|
||||
return childrenCnt;
|
||||
}
|
||||
|
||||
public void setChildrenCnt(String childrenCnt) {
|
||||
this.childrenCnt = childrenCnt;
|
||||
}
|
||||
|
||||
public String getChildrenBirthday() {
|
||||
return childrenBirthday;
|
||||
}
|
||||
|
||||
public void setChildrenBirthday(String childrenBirthday) {
|
||||
this.childrenBirthday = childrenBirthday;
|
||||
}
|
||||
|
||||
public String getServiceResult() {
|
||||
return serviceResult;
|
||||
}
|
||||
|
||||
public void setServiceResult(String serviceResult) {
|
||||
this.serviceResult = serviceResult;
|
||||
}
|
||||
|
||||
public String getMnychRdcxptVhcle() {
|
||||
return mnychRdcxptVhcle;
|
||||
}
|
||||
|
||||
public void setMnychRdcxptVhcle(String mnychRdcxptVhcle) {
|
||||
this.mnychRdcxptVhcle = mnychRdcxptVhcle;
|
||||
}
|
||||
|
||||
public String getAthzerAt() {
|
||||
return athzerAt;
|
||||
}
|
||||
|
||||
public void setAthzerAt(String athzerAt) {
|
||||
this.athzerAt = athzerAt;
|
||||
}
|
||||
|
||||
public String getResName() {
|
||||
return resName;
|
||||
}
|
||||
|
||||
public void setResName(String resName) {
|
||||
this.resName = resName;
|
||||
}
|
||||
|
||||
public String getRelCd() {
|
||||
return relCd;
|
||||
}
|
||||
|
||||
public void setRelCd(String relCd) {
|
||||
this.relCd = relCd;
|
||||
}
|
||||
|
||||
public String getAuthoriPsnYn() {
|
||||
return authoriPsnYn;
|
||||
}
|
||||
|
||||
public void setAuthoriPsnYn(String authoriPsnYn) {
|
||||
this.authoriPsnYn = authoriPsnYn;
|
||||
}
|
||||
|
||||
public String getSubjKbnCd() {
|
||||
return subjKbnCd;
|
||||
}
|
||||
|
||||
public void setSubjKbnCd(String subjKbnCd) {
|
||||
this.subjKbnCd = subjKbnCd;
|
||||
}
|
||||
|
||||
public String getWondClassCd() {
|
||||
return wondClassCd;
|
||||
}
|
||||
|
||||
public void setWondClassCd(String wondClassCd) {
|
||||
this.wondClassCd = wondClassCd;
|
||||
}
|
||||
|
||||
public String getInquRsltCd() {
|
||||
return inquRsltCd;
|
||||
}
|
||||
|
||||
public void setInquRsltCd(String inquRsltCd) {
|
||||
this.inquRsltCd = inquRsltCd;
|
||||
}
|
||||
|
||||
public String getEntrprsNm() {
|
||||
return entrprsNm;
|
||||
}
|
||||
|
||||
public void setEntrprsNm(String entrprsNm) {
|
||||
this.entrprsNm = entrprsNm;
|
||||
}
|
||||
|
||||
public String getBsnmRegistNo() {
|
||||
return bsnmRegistNo;
|
||||
}
|
||||
|
||||
public void setBsnmRegistNo(String bsnmRegistNo) {
|
||||
this.bsnmRegistNo = bsnmRegistNo;
|
||||
}
|
||||
|
||||
public String getCprRegistNo() {
|
||||
return cprRegistNo;
|
||||
}
|
||||
|
||||
public void setCprRegistNo(String cprRegistNo) {
|
||||
this.cprRegistNo = cprRegistNo;
|
||||
}
|
||||
|
||||
public String getChargerNm() {
|
||||
return chargerNm;
|
||||
}
|
||||
|
||||
public void setChargerNm(String chargerNm) {
|
||||
this.chargerNm = chargerNm;
|
||||
}
|
||||
|
||||
public String getChargerCi() {
|
||||
return chargerCi;
|
||||
}
|
||||
|
||||
public void setChargerCi(String chargerCi) {
|
||||
this.chargerCi = chargerCi;
|
||||
}
|
||||
|
||||
public String getChargerMobileNo() {
|
||||
return chargerMobileNo;
|
||||
}
|
||||
|
||||
public void setChargerMobileNo(String chargerMobileNo) {
|
||||
this.chargerMobileNo = chargerMobileNo;
|
||||
}
|
||||
|
||||
public String getInfoProvdAgreAt() {
|
||||
return infoProvdAgreAt;
|
||||
}
|
||||
|
||||
public void setInfoProvdAgreAt(String infoProvdAgreAt) {
|
||||
this.infoProvdAgreAt = infoProvdAgreAt;
|
||||
}
|
||||
|
||||
public String getTunnelFeeAgreAt() {
|
||||
return tunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public void setTunnelFeeAgreAt(String tunnelFeeAgreAt) {
|
||||
this.tunnelFeeAgreAt = tunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public String getParkFeeAgreAt() {
|
||||
return parkFeeAgreAt;
|
||||
}
|
||||
|
||||
public void setParkFeeAgreAt(String parkFeeAgreAt) {
|
||||
this.parkFeeAgreAt = parkFeeAgreAt;
|
||||
}
|
||||
|
||||
public String getJmpTunnelFeeAgreAt() {
|
||||
return jmpTunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public void setJmpTunnelFeeAgreAt(String jmpTunnelFeeAgreAt) {
|
||||
this.jmpTunnelFeeAgreAt = jmpTunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public String getTunnelPenaltyAgreAt() {
|
||||
return tunnelPenaltyAgreAt;
|
||||
}
|
||||
|
||||
public void setTunnelPenaltyAgreAt(String tunnelPenaltyAgreAt) {
|
||||
this.tunnelPenaltyAgreAt = tunnelPenaltyAgreAt;
|
||||
}
|
||||
|
||||
public String getPenaltyAgreAt() {
|
||||
return penaltyAgreAt;
|
||||
}
|
||||
|
||||
public void setPenaltyAgreAt(String penaltyAgreAt) {
|
||||
this.penaltyAgreAt = penaltyAgreAt;
|
||||
}
|
||||
|
||||
public String getSsmTunnelFeeAgreAt() {
|
||||
return ssmTunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public void setSsmTunnelFeeAgreAt(String ssmTunnelFeeAgreAt) {
|
||||
this.ssmTunnelFeeAgreAt = ssmTunnelFeeAgreAt;
|
||||
}
|
||||
|
||||
public List<Map> getTempCarInfos() {
|
||||
return tempCarInfos;
|
||||
}
|
||||
|
||||
public void setTempCarInfos(List<Map> tempCarInfos) {
|
||||
for (Map carInfo: tempCarInfos) {
|
||||
carInfo.put("mberNo",this.mberNo);
|
||||
}
|
||||
this.tempCarInfos = tempCarInfos;
|
||||
}
|
||||
|
||||
public List<Map> getTempCreditInfos() {
|
||||
return tempCreditInfos;
|
||||
}
|
||||
|
||||
public void setTempCreditInfos(List<Map> tempCreditInfos) {
|
||||
this.tempCreditInfos = tempCreditInfos;
|
||||
}
|
||||
|
||||
public List<Map> getTempBankInfos() {
|
||||
return tempBankInfos;
|
||||
}
|
||||
|
||||
public void setTempBankInfos(List<Map> tempBankInfos) {
|
||||
this.tempBankInfos = tempBankInfos;
|
||||
}
|
||||
|
||||
public String getTermsCheck1() {
|
||||
return termsCheck1;
|
||||
}
|
||||
|
||||
public void setTermsCheck1(String termsCheck1) {
|
||||
this.termsCheck1 = termsCheck1;
|
||||
}
|
||||
|
||||
public String getTermsCheck2() {
|
||||
return termsCheck2;
|
||||
}
|
||||
|
||||
public void setTermsCheck2(String termsCheck2) {
|
||||
this.termsCheck2 = termsCheck2;
|
||||
}
|
||||
|
||||
public String getTermsCheck3() {
|
||||
return termsCheck3;
|
||||
}
|
||||
|
||||
public void setTermsCheck3(String termsCheck3) {
|
||||
this.termsCheck3 = termsCheck3;
|
||||
}
|
||||
|
||||
public String getTermsCheck4() {
|
||||
return termsCheck4;
|
||||
}
|
||||
|
||||
public void setTermsCheck4(String termsCheck4) {
|
||||
this.termsCheck4 = termsCheck4;
|
||||
}
|
||||
|
||||
public String getTermsCheck5() {
|
||||
return termsCheck5;
|
||||
}
|
||||
|
||||
public void setTermsCheck5(String termsCheck5) {
|
||||
this.termsCheck5 = termsCheck5;
|
||||
}
|
||||
|
||||
public String getPhoneNum() {
|
||||
return phoneNum;
|
||||
}
|
||||
|
||||
public void setPhoneNum(String phoneNum) {
|
||||
this.phoneNum = phoneNum;
|
||||
}
|
||||
|
||||
public String getSmsKey() {
|
||||
return smsKey;
|
||||
}
|
||||
|
||||
public void setSmsKey(String smsKey) {
|
||||
this.smsKey = smsKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TempUserSessionInfoDTO{" +
|
||||
"makeTime=" + makeTime +
|
||||
", mberNo='" + mberNo + '\'' +
|
||||
", mberId='" + mberId + '\'' +
|
||||
", mberty='" + mberty + '\'' +
|
||||
", mberPw='" + mberPw + '\'' +
|
||||
", mberNm='" + mberNm + '\'' +
|
||||
", mberCi='" + mberCi + '\'' +
|
||||
", mberMobileNo='" + mberMobileNo + '\'' +
|
||||
", mberBirthDt='" + mberBirthDt + '\'' +
|
||||
", infoProvdAgreAt='" + infoProvdAgreAt + '\'' +
|
||||
", tunnelFeeAgreAt='" + tunnelFeeAgreAt + '\'' +
|
||||
", parkFeeAgreAt='" + parkFeeAgreAt + '\'' +
|
||||
", jmpTunnelFeeAgreAt='" + jmpTunnelFeeAgreAt + '\'' +
|
||||
", ssmTunnelFeeAgreAt='" + ssmTunnelFeeAgreAt + '\'' +
|
||||
", tunnelPenaltyAgreAt='" + tunnelPenaltyAgreAt + '\'' +
|
||||
", penaltyAgreAt='" + penaltyAgreAt + '\'' +
|
||||
", trnsitDscntAt='" + trnsitDscntAt + '\'' +
|
||||
", mnychRdcxptAt='" + mnychRdcxptAt + '\'' +
|
||||
", childrenCnt='" + childrenCnt + '\'' +
|
||||
", childrenBirthday='" + childrenBirthday + '\'' +
|
||||
", serviceResult='" + serviceResult + '\'' +
|
||||
", mnychRdcxptVhcle='" + mnychRdcxptVhcle + '\'' +
|
||||
", athzerAt='" + athzerAt + '\'' +
|
||||
", resName='" + resName + '\'' +
|
||||
", relCd='" + relCd + '\'' +
|
||||
", authoriPsnYn='" + authoriPsnYn + '\'' +
|
||||
", subjKbnCd='" + subjKbnCd + '\'' +
|
||||
", wondClassCd='" + wondClassCd + '\'' +
|
||||
", inquRsltCd='" + inquRsltCd + '\'' +
|
||||
", entrprsNm='" + entrprsNm + '\'' +
|
||||
", bsnmRegistNo='" + bsnmRegistNo + '\'' +
|
||||
", cprRegistNo='" + cprRegistNo + '\'' +
|
||||
", chargerNm='" + chargerNm + '\'' +
|
||||
", chargerCi='" + chargerCi + '\'' +
|
||||
", chargerMobileNo='" + chargerMobileNo + '\'' +
|
||||
", tempUserInfo=" + tempUserInfo +
|
||||
", tempCarInfos=" + tempCarInfos +
|
||||
", mnychRdcxpt=" + mnychRdcxpt +
|
||||
", tempCreditInfos=" + tempCreditInfos +
|
||||
", tempBankInfos=" + tempBankInfos +
|
||||
", termsCheck1='" + termsCheck1 + '\'' +
|
||||
", termsCheck2='" + termsCheck2 + '\'' +
|
||||
", termsCheck3='" + termsCheck3 + '\'' +
|
||||
", termsCheck4='" + termsCheck4 + '\'' +
|
||||
", termsCheck5='" + termsCheck5 + '\'' +
|
||||
", phoneNum='" + phoneNum + '\'' +
|
||||
", smsKey='" + smsKey + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue