벡엔드 간소화
parent
c749f60a5d
commit
4708eb31e5
|
|
@ -58,7 +58,24 @@ dependencies {
|
|||
exclude(module: 'commons-logging')
|
||||
}
|
||||
implementation group: 'org.egovframe.rte', name: 'org.egovframe.rte.fdl.cmmn', version:'4.1.0'
|
||||
implementation group: 'org.egovframe.rte', name: 'org.egovframe.rte.fdl.property', version:'4.1.0'
|
||||
implementation group: 'org.egovframe.rte', name: 'org.egovframe.rte.psl.dataaccess', version:'4.1.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger2
|
||||
implementation group: 'io.springfox', name: 'springfox-swagger2', version: '3.0.0'
|
||||
// https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui
|
||||
implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '3.0.0'
|
||||
// https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter
|
||||
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
|
||||
|
||||
// https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api
|
||||
implementation group: 'jakarta.validation', name: 'jakarta.validation-api', version: '3.0.2'
|
||||
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api
|
||||
implementation group: 'io.jsonwebtoken', name: 'jjwt-api', version: '0.11.5'
|
||||
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl
|
||||
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-impl', version: '0.11.5'
|
||||
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson
|
||||
runtimeOnly group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5'
|
||||
|
||||
|
||||
// json
|
||||
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class BaseController {
|
||||
|
||||
@Resource(name = "leaveaTrace")
|
||||
LeaveaTrace leaveaTrace;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
@Schema(description = "사용자 정보 VO")
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoginVO implements Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -8274004534207618049L;
|
||||
|
||||
@Schema(description = "아이디")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "이름")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "주민등록번호")
|
||||
private String ihidNum;
|
||||
|
||||
@Email(regexp = "[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,3}")
|
||||
@Schema(description = "이메일주소")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "비밀번호")
|
||||
private String password;
|
||||
|
||||
@Schema(description = "비밀번호 힌트")
|
||||
private String passwordHint;
|
||||
|
||||
@Schema(description = "비밀번호 정답")
|
||||
private String passwordCnsr;
|
||||
|
||||
@Schema(description = "사용자 구분", allowableValues = {"GNR", "ENT", "USR"}, defaultValue = "USR")
|
||||
private String userSe;
|
||||
|
||||
@Schema(description = "조직(부서)ID")
|
||||
private String orgnztId;
|
||||
|
||||
@Schema(description = "조직(부서)명")
|
||||
private String orgnztNm;
|
||||
|
||||
@Schema(description = "고유아이디")
|
||||
private String uniqId;
|
||||
|
||||
@Schema(description = "로그인 후 이동할 페이지")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "사용자 IP정보")
|
||||
private String ip;
|
||||
|
||||
@Schema(description = "GPKI인증 DN")
|
||||
private String dn;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : 정완배
|
||||
* @since : 2023. 8. 9.
|
||||
* @version : 1.0
|
||||
*
|
||||
* @package : egovframework.com.cmm
|
||||
* @filename : ResponseCode.java
|
||||
* @modificationInformation
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2023. 8. 9. 정완배 주석추가
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
public enum ResponseCode {
|
||||
|
||||
SUCCESS(200, "성공했습니다."),
|
||||
AUTH_ERROR(403, "인가된 사용자가 아닙니다."),
|
||||
DELETE_ERROR(700, "삭제 중 내부 오류가 발생했습니다."),
|
||||
SAVE_ERROR(800, "저장시 내부 오류가 발생했습니다."),
|
||||
INPUT_CHECK_ERROR(900, "입력값 무결성 오류 입니다.");
|
||||
|
||||
private int code;
|
||||
private String message;
|
||||
|
||||
private ResponseCode(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : 정완배
|
||||
* @since : 2023. 8. 9.
|
||||
* @version : 1.0
|
||||
*
|
||||
* @package : egovframework.com.cmm.service
|
||||
* @filename : ResultVO.java
|
||||
* @modificationInformation
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2023. 8. 9. 정완배 주석추가
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
@Schema(description = "응답 객체 VO")
|
||||
@Getter
|
||||
@Setter
|
||||
public class ResultVO {
|
||||
|
||||
@Schema(description = "응답 코드")
|
||||
private int resultCode = 0;
|
||||
|
||||
@Schema(description = "응답 메시지")
|
||||
private String resultMessage = "OK";
|
||||
private Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
public void putResult(String key, Object value) {
|
||||
result.put(key, value);
|
||||
}
|
||||
|
||||
public Object getResult(String key) {
|
||||
return this.result.get(key);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 세션 VO 클래스
|
||||
* @author 공통서비스 개발팀 박지욱
|
||||
* @since 2009.03.06
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.06 박지욱 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
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;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.annotation.WebFilter;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* SimpleCORSFilter.java 클래스
|
||||
*
|
||||
* @author 신용호
|
||||
* @since 2019. 10. 18.
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2019.10.18 신용호 최초 생성
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
@WebFilter(urlPatterns = "*.do")
|
||||
public class SimpleCORSFilter implements Filter {
|
||||
|
||||
//private final List<String> allowedOrigins = Arrays.asList("http://localhost:9700");
|
||||
|
||||
public SimpleCORSFilter() {
|
||||
log.info("SimpleCORSFilter init");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
log.debug("===>>> SimpleCORSFilter > doFilter()");
|
||||
//HttpServletRequest request = (HttpServletRequest)req;
|
||||
HttpServletResponse response = (HttpServletResponse)res;
|
||||
|
||||
// Access-Control-Allow-Origin
|
||||
//String origin = request.getHeader("Origin");
|
||||
|
||||
//HTTP parameter directly written to HTTP header
|
||||
String originHeader = EgovProperties.getProperty("Globals.Allow.Origin");
|
||||
|
||||
log.debug("===>>> origin = " + originHeader);
|
||||
|
||||
if (isValidOriginHeader(originHeader)) {
|
||||
// Security - Potential HTTP Response Splitting 분할응답 조치
|
||||
originHeader = originHeader
|
||||
.replace("\r", "")
|
||||
.replace("\n", "");
|
||||
}
|
||||
|
||||
setCorsHeaders(response, originHeader);
|
||||
|
||||
chain.doFilter(req, res);
|
||||
}
|
||||
|
||||
private static boolean isValidOriginHeader(String originHeader) {
|
||||
return originHeader != null && !originHeader.isEmpty();
|
||||
}
|
||||
|
||||
private static void setCorsHeaders(HttpServletResponse response, String originHeader) {
|
||||
response.setHeader("Access-Control-Allow-Origin", originHeader);
|
||||
|
||||
// Access-Control-Max-Age
|
||||
response.setHeader("Access-Control-Max-Age", "3600");
|
||||
|
||||
// Access-Control-Allow-Credentials
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
|
||||
// Access-Control-Allow-Methods
|
||||
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE");
|
||||
|
||||
// Access-Control-Allow-Headers
|
||||
response.setHeader("Access-Control-Allow-Headers",
|
||||
"Origin, X-Requested-With, Content-Type, Accept, Authorization, " + "X-CSRF-TOKEN");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {}
|
||||
|
||||
@Override
|
||||
public void destroy() {}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.dbnt.kcscbackend.config.common;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : 정완배
|
||||
* @since : 2023. 8. 9.
|
||||
* @version : 1.0
|
||||
*
|
||||
* @package : egovframework.com.config
|
||||
* @filename : SwaggerConfig.java
|
||||
* @modificationInformation
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2023. 8. 9. 정완배 주석추가
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig {
|
||||
|
||||
private static final String API_NAME = "Simple Homepage Project API";
|
||||
private static final String API_VERSION = "4.1.0";
|
||||
private static final String API_DESCRIPTION = "심플홈페이지 프로젝트 명세서";
|
||||
|
||||
@Bean
|
||||
public Docket api() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("egovframework"))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.securityContexts(Arrays.asList(securityContext())) // 스웨그에서 컨텐츠 url 접근 시 인증처리를 위한 보안 규칙 호출
|
||||
.securitySchemes(Arrays.asList(apiKey())); // 스웨그 화면상단에 토큰값 입력하는 창 구조 호출, 여기에 배열로 추가 apiKey메서드를 입력가능
|
||||
}
|
||||
|
||||
// Authorization창에 Token값 입력 화면 구조
|
||||
private ApiKey apiKey() {
|
||||
return new ApiKey("Authorization", "Authorization", "header");
|
||||
}
|
||||
|
||||
// 스웨그에서 컨텐츠 url 접근 시 인증처리를 위한 보안 규칙 추가(아래)
|
||||
private SecurityContext securityContext() {
|
||||
return SecurityContext
|
||||
.builder()
|
||||
.securityReferences(defaultAuth()).operationSelector(operationContext -> true).build();
|
||||
}
|
||||
|
||||
// 토큰 인증영역 배열리스트을 반환하는 매서드
|
||||
List<SecurityReference> defaultAuth() {
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); // 인증영역 객체 생성
|
||||
AuthorizationScope[] authorizationScopeArray = new AuthorizationScope[1]; // 빈 배열 인증영역 객체 생성
|
||||
authorizationScopeArray[0] = authorizationScope; // 배열변수에 인증영역 객체 등록
|
||||
return Arrays.asList(new SecurityReference("Authorization", authorizationScopeArray)); // 여기에 배열로 추가 SecurityReference객체를 입력가능
|
||||
}
|
||||
|
||||
public ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(API_NAME)
|
||||
.version(API_VERSION)
|
||||
.description(API_DESCRIPTION)
|
||||
.contact(new Contact("eGovFrame", "https://www.egovframe.go.kr/", "egovframesupport@gmail.com"))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.egovframe.rte.fdl.cmmn.trace.handler.TraceHandler;
|
||||
|
||||
/**
|
||||
* @Class Name : EgovComTraceHandler.java
|
||||
* @Description : 공통서비스의 trace 처리 클래스
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- ------- -------------------
|
||||
* 2011. 09. 30. JJY
|
||||
*
|
||||
* @author JJY
|
||||
* @since 2011. 9. 30.
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class EgovComTraceHandler implements TraceHandler {
|
||||
|
||||
/**
|
||||
* 발생된 메시지를 출력한다.
|
||||
*/
|
||||
public void todo(Class<?> clazz, String message) {
|
||||
//log.debug("log ==> DefaultTraceHandler run...............");
|
||||
log.debug("[TRACE]CLASS::: {}", clazz.getName());
|
||||
log.debug("[TRACE]MESSAGE::: {}", message);
|
||||
//이곳에서 후속처리로 필요한 액션을 취할 수 있다.
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace;
|
||||
import org.egovframe.rte.fdl.cmmn.trace.handler.TraceHandler;
|
||||
import org.egovframe.rte.fdl.cmmn.trace.manager.DefaultTraceHandleManager;
|
||||
import org.egovframe.rte.fdl.cmmn.trace.manager.TraceHandlerService;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
|
||||
/**
|
||||
* @ClassName : EgovConfigAppCommon.java
|
||||
* @Description : 공통 Bean 설정
|
||||
*
|
||||
* @author : 윤주호
|
||||
* @since : 2021. 7. 20
|
||||
* @version : 1.0
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- ------------ ---------------------
|
||||
* 2021. 7. 20 윤주호 최초 생성
|
||||
* 2023. 5. 05 crlee remove EgovMessageSource config
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = "com.dbnt.kcscbackend", includeFilters = {
|
||||
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Service.class),
|
||||
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Repository.class)
|
||||
}, excludeFilters = {
|
||||
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.class),
|
||||
@ComponentScan.Filter(type = FilterType.ANNOTATION, value = Configuration.class)
|
||||
})
|
||||
public class EgovConfigAppCommon {
|
||||
|
||||
/**
|
||||
* @return AntPathMatcher 등록. Ant 경로 패턴 경로와 일치하는지 여부를 확인
|
||||
*/
|
||||
@Bean
|
||||
public AntPathMatcher antPathMatcher() {
|
||||
return new AntPathMatcher();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return [LeaveaTrace 설정] defaultTraceHandler 등록
|
||||
*/
|
||||
@Bean
|
||||
public EgovComTraceHandler defaultTraceHandler() {
|
||||
return new EgovComTraceHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return [LeaveaTrace 설정] traceHandlerService 등록. TraceHandler 설정
|
||||
*/
|
||||
@Bean
|
||||
public DefaultTraceHandleManager traceHandlerService() {
|
||||
DefaultTraceHandleManager defaultTraceHandleManager = new DefaultTraceHandleManager();
|
||||
defaultTraceHandleManager.setReqExpMatcher(antPathMatcher());
|
||||
defaultTraceHandleManager.setPatterns(new String[] {"*"});
|
||||
defaultTraceHandleManager.setHandlers(new TraceHandler[] {defaultTraceHandler()});
|
||||
return defaultTraceHandleManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return [LeaveaTrace 설정] LeaveaTrace 등록
|
||||
*/
|
||||
@Bean
|
||||
public LeaveaTrace leaveaTrace() {
|
||||
LeaveaTrace leaveaTrace = new LeaveaTrace();
|
||||
leaveaTrace.setTraceHandlerServices(new TraceHandlerService[] {traceHandlerService()});
|
||||
return leaveaTrace;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
|
||||
/**
|
||||
* fileName : EgovConfigAppMsg
|
||||
* author : crlee
|
||||
* date : 2023/05/05
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/05/05 crlee 최초 생성
|
||||
*/
|
||||
@Configuration
|
||||
public class EgovConfigAppMsg {
|
||||
|
||||
/**
|
||||
* @return [Resource 설정] 메세지 Properties 경로 설정
|
||||
*/
|
||||
@Bean
|
||||
public ReloadableResourceBundleMessageSource messageSource() {
|
||||
ReloadableResourceBundleMessageSource reloadableResourceBundleMessageSource = new ReloadableResourceBundleMessageSource();
|
||||
|
||||
reloadableResourceBundleMessageSource.setBasenames(
|
||||
"classpath:/org/egovframe/rte/fdl/idgnr/messages/idgnr",
|
||||
"classpath:/org/egovframe/rte/fdl/property/messages/properties");
|
||||
reloadableResourceBundleMessageSource.setCacheSeconds(60);
|
||||
return reloadableResourceBundleMessageSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return [Resource 설정] 메세지 소스 등록
|
||||
*/
|
||||
@Bean
|
||||
public EgovMessageSource egovMessageSource() {
|
||||
EgovMessageSource egovMessageSource = new EgovMessageSource();
|
||||
egovMessageSource.setReloadableResourceBundleMessageSource(messageSource());
|
||||
return egovMessageSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName : EgovConfigAppProperties.java
|
||||
* @Description : Properties 설정
|
||||
*
|
||||
* @author : 윤주호
|
||||
* @since : 2021. 7. 20
|
||||
* @version : 1.0
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------------- ------------ ---------------------
|
||||
* 2021. 7. 20 윤주호 최초 생성
|
||||
* </pre>
|
||||
*
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class EgovConfigAppProperties {
|
||||
|
||||
@Value("${Globals.fileStorePath}")
|
||||
private String fileStorePath;
|
||||
|
||||
@Value("${Globals.addedOptions}")
|
||||
private String addedOptions;
|
||||
|
||||
@Value("${Globals.pageUnit}")
|
||||
private String pageUnit;
|
||||
@Value("${Globals.pageSize}")
|
||||
private String pageSize;
|
||||
@Value("${Globals.posblAtchFileSize}")
|
||||
private String posblAtchFileSize;
|
||||
|
||||
|
||||
@Bean(destroyMethod = "destroy")
|
||||
public EgovPropertyServiceImpl propertiesService() {
|
||||
EgovPropertyServiceImpl egovPropertyServiceImpl = new EgovPropertyServiceImpl();
|
||||
|
||||
Map<String, String> properties = new HashMap<String, String>();
|
||||
properties.put("Globals.pageUnit", pageUnit);
|
||||
properties.put("Globals.pageSize", pageSize);
|
||||
properties.put("Globals.posblAtchFileSize", posblAtchFileSize);
|
||||
properties.put("Globals.fileStorePath", fileStorePath);
|
||||
properties.put("Globals.addedOptions", addedOptions);
|
||||
|
||||
egovPropertyServiceImpl.setProperties(properties);
|
||||
return egovPropertyServiceImpl;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 메시지 리소스 사용을 위한 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Locale 정의된 메세지 조회
|
||||
* @param code - 메세지 코드
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage(String code) {
|
||||
return this.getMessage(code, Locale.getDefault());
|
||||
}
|
||||
/**
|
||||
* 정의된 메세지 조회
|
||||
* @param code - 메세지 코드
|
||||
* @param locale - locale 설정
|
||||
* @return String
|
||||
*/
|
||||
public String getMessage(String code, Locale locale) {
|
||||
return getReloadableResourceBundleMessageSource().getMessage(code, null, locale);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,229 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.ResourcePatternUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
//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
|
||||
*
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
public class EgovProperties {
|
||||
|
||||
//프로퍼티값 로드시 에러발생하면 반환되는 에러문자열
|
||||
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 String FILE_SEPARATOR = System.getProperty("file.separator");
|
||||
|
||||
//프로퍼티 파일의 물리적 위치
|
||||
/*public static final String GLOBALS_PROPERTIES_FILE
|
||||
= System.getProperty("user.home") + System.getProperty("file.separator") + "egovProps"
|
||||
+ System.getProperty("file.separator") + "globals.properties";*/
|
||||
|
||||
// 프로퍼티 파일의 위치 prefix
|
||||
// /target/classes/egovframework
|
||||
//public static final String RELATIVE_PATH_PREFIX = "classpath:" + FILE_SEPARATOR + "egovframework";
|
||||
|
||||
// 프로퍼티 파일의 위치
|
||||
// /target/classes/egovframework/egovProps/globals.properties
|
||||
//public static final String GLOBALS_PROPERTIES_FILE = RELATIVE_PATH_PREFIX + FILE_SEPARATOR +"egovProps"+ FILE_SEPARATOR + "globals.properties";
|
||||
|
||||
// /target/classes/application.properties
|
||||
public static final String GLOBALS_PROPERTIES_FILE = "classpath:" + FILE_SEPARATOR + "application.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";
|
||||
|
||||
Resource resources = ResourcePatternUtils.getResourcePatternResolver(new DefaultResourceLoader())
|
||||
.getResource(GLOBALS_PROPERTIES_FILE);
|
||||
|
||||
debug(GLOBALS_PROPERTIES_FILE + " : " + keyName);
|
||||
|
||||
try (InputStream in = resources.getInputStream()) {
|
||||
Properties props = new Properties();
|
||||
props.load(new java.io.BufferedInputStream(in));
|
||||
value = props.getProperty(keyName).trim();
|
||||
} catch (FileNotFoundException fne) {
|
||||
debug(fne);
|
||||
} catch (IOException ioe) {
|
||||
debug(ioe);
|
||||
}
|
||||
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 = EgovWebUtil.filePathBlackList(property.replace("\\", FILE_SEPARATOR).replace("/", FILE_SEPARATOR));
|
||||
try (FileInputStream fis = new FileInputStream(src)) {
|
||||
|
||||
File srcFile = new File(src);
|
||||
if (srcFile.exists()) {
|
||||
|
||||
Properties props = new Properties();
|
||||
props.load(new java.io.BufferedInputStream(fis));
|
||||
|
||||
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 (FileNotFoundException ex) {
|
||||
debug("FileNotFoundException:" + ex);
|
||||
} catch (IOException ex) {
|
||||
debug("IOException:" + ex);
|
||||
}
|
||||
return keyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 시스템 로그를 출력한다.
|
||||
* @param obj Object
|
||||
*/
|
||||
private static void debug(Object obj) {
|
||||
if (obj instanceof Exception) {
|
||||
log.debug("IGNORED: {}", ((Exception)obj).getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
package com.dbnt.kcscbackend.config.egov;
|
||||
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 교차접속 스크립트 공격 취약성 방지(파라미터 문자열 교체)
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ----------- -------- ---------------------------
|
||||
* 2011.10.10 한성곤 최초 생성
|
||||
* 2017-02-07 이정은 시큐어코딩(ES) - 시큐어코딩 경로 조작 및 자원 삽입[CWE-22, CWE-23, CWE-95, CWE-99]
|
||||
* 2018.08.17 신용호 filePathBlackList 수정
|
||||
* 2018.10.10 신용호 . => \\.으로 수정
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
public class EgovWebUtil {
|
||||
|
||||
|
||||
public static ResultVO handleAuthError(int code, String msg) {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
resultVO.setResultCode(code);
|
||||
resultVO.setResultMessage(msg);
|
||||
return resultVO;
|
||||
}
|
||||
public static String clearXSSMinimum(String value) {
|
||||
if (value == null || value.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
String returnValue = value;
|
||||
|
||||
returnValue = returnValue.replaceAll("&", "&");
|
||||
returnValue = returnValue.replaceAll("<", "<");
|
||||
returnValue = returnValue.replaceAll(">", ">");
|
||||
returnValue = returnValue.replaceAll("\"", """);
|
||||
returnValue = returnValue.replaceAll("\'", "'");
|
||||
returnValue = returnValue.replaceAll("\\.", ".");
|
||||
returnValue = returnValue.replaceAll("%2E", ".");
|
||||
returnValue = returnValue.replaceAll("%2F", "/");
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String clearXSSMaximum(String value) {
|
||||
String returnValue = value;
|
||||
returnValue = clearXSSMinimum(returnValue);
|
||||
|
||||
returnValue = returnValue.replaceAll("%00", null);
|
||||
|
||||
returnValue = returnValue.replaceAll("%", "%");
|
||||
|
||||
// \\. => .
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\./", ""); // ../
|
||||
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); // ..\
|
||||
returnValue = returnValue.replaceAll("\\./", ""); // ./
|
||||
returnValue = returnValue.replaceAll("%2F", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String filePathBlackList(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
returnValue = returnValue.replaceAll("\\.\\.", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 행안부 보안취약점 점검 조치 방안.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static String filePathReplaceAll(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
returnValue = returnValue.replaceAll("/", "");
|
||||
returnValue = returnValue.replaceAll("\\\\", ""); // \
|
||||
returnValue = returnValue.replaceAll("\\.\\.", ""); // ..
|
||||
returnValue = returnValue.replaceAll("&", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String fileInjectPathReplaceAll(String value) {
|
||||
String returnValue = value;
|
||||
if (returnValue == null || returnValue.trim().equals("")) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
returnValue = returnValue.replaceAll("/", "");
|
||||
returnValue = returnValue.replaceAll("\\..", ""); // ..
|
||||
returnValue = returnValue.replaceAll("\\\\", "");// \
|
||||
returnValue = returnValue.replaceAll("&", "");
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static String filePathWhiteList(String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static boolean isIPAddress(String str) {
|
||||
Pattern ipPattern = Pattern.compile("\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}");
|
||||
|
||||
return ipPattern.matcher(str).matches();
|
||||
}
|
||||
|
||||
public static String removeCRLF(String parameter) {
|
||||
return parameter.replaceAll("\r", "").replaceAll("\n", "");
|
||||
}
|
||||
|
||||
public static String removeSQLInjectionRisk(String parameter) {
|
||||
return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("%", "").replaceAll(";", "").replaceAll("-", "").replaceAll("\\+", "").replaceAll(",", "");
|
||||
}
|
||||
|
||||
public static String removeOSCmdRisk(String parameter) {
|
||||
return parameter.replaceAll("\\p{Space}", "").replaceAll("\\*", "").replaceAll("\\|", "").replaceAll(";", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.dbnt.kcscbackend.config.jwt;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.config.egov.EgovProperties;
|
||||
import com.dbnt.kcscbackend.config.common.LoginVO;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : 정완배
|
||||
* @since : 2023. 8. 9.
|
||||
* @version : 1.0
|
||||
*
|
||||
* @package : egovframework.com.jwt
|
||||
* @filename : EgovJwtTokenUtil.java
|
||||
* @modificationInformation
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2023. 8. 9. 정완배 주석추가
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
//security 관련 제외한 jwt util 클래스
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EgovJwtTokenUtil implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = -5180902194184255251L;
|
||||
//public static final long JWT_TOKEN_VALIDITY = 24 * 60 * 60; //하루
|
||||
public static final long JWT_TOKEN_VALIDITY = (long) ((1 * 60 * 60) / 60) * 60; //토큰의 유효시간 설정, 기본 60분
|
||||
|
||||
public static final String SECRET_KEY = EgovProperties.getProperty("Globals.jwt.secret");
|
||||
|
||||
//retrieve username from jwt token
|
||||
public String getUserIdFromToken(String token) {
|
||||
Claims claims = getClaimFromToken(token);
|
||||
return claims.get("id").toString();
|
||||
}
|
||||
public String getUserSeFromToken(String token) {
|
||||
Claims claims = getClaimFromToken(token);
|
||||
return claims.get("userSe").toString();
|
||||
}
|
||||
public String getInfoFromToken(String type, String token) {
|
||||
Claims claims = getClaimFromToken(token);
|
||||
return claims.get(type).toString();
|
||||
}
|
||||
public Claims getClaimFromToken(String token) {
|
||||
final Claims claims = getAllClaimsFromToken(token);
|
||||
return claims;
|
||||
}
|
||||
|
||||
//for retrieveing any information from token we will need the secret key
|
||||
public Claims getAllClaimsFromToken(String token) {
|
||||
log.debug("===>>> secret = "+SECRET_KEY);
|
||||
return Jwts.parser().setSigningKey(SECRET_KEY).parseClaimsJws(token).getBody();
|
||||
}
|
||||
|
||||
//generate token for user
|
||||
public String generateToken(LoginVO loginVO) {
|
||||
return doGenerateToken(loginVO, "Authorization");
|
||||
}
|
||||
|
||||
//while creating the token -
|
||||
//1. Define claims of the token, like Issuer, Expiration, Subject, and the ID
|
||||
//2. Sign the JWT using the HS512 algorithm and secret key.
|
||||
//3. According to JWS Compact Serialization(https://tools.ietf.org/html/draft-ietf-jose-json-web-signature-41#section-3.1)
|
||||
// compaction of the JWT to a URL-safe string
|
||||
private String doGenerateToken(LoginVO loginVO, String subject) {
|
||||
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put("id", loginVO.getId() );
|
||||
claims.put("name", loginVO.getName() );
|
||||
claims.put("userSe", loginVO.getUserSe() );
|
||||
claims.put("orgnztId", loginVO.getOrgnztId() );
|
||||
claims.put("uniqId", loginVO.getUniqId() );
|
||||
claims.put("type", subject);
|
||||
|
||||
log.debug("===>>> secret = "+SECRET_KEY);
|
||||
return Jwts.builder().setClaims(claims).setSubject(subject).setIssuedAt(new Date(System.currentTimeMillis()))
|
||||
.setExpiration(new Date(System.currentTimeMillis() + JWT_TOKEN_VALIDITY * 1000))
|
||||
.signWith(SignatureAlgorithm.HS512, SECRET_KEY).compact();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
package com.dbnt.kcscbackend.config.jwt;
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.core.AuthenticationException;
|
||||
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* fileName : JwtAuthenticationEntryPoint
|
||||
* author : crlee
|
||||
* date : 2023/06/11
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/06/11 crlee 최초 생성
|
||||
*/
|
||||
|
||||
@Component
|
||||
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||
|
||||
|
||||
@Override
|
||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException {
|
||||
|
||||
ResultVO resultVO = new ResultVO();
|
||||
resultVO.setResultCode(ResponseCode.AUTH_ERROR.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.AUTH_ERROR.getMessage());
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
//Convert object to JSON string
|
||||
String jsonInString = mapper.writeValueAsString(resultVO);
|
||||
|
||||
|
||||
|
||||
response.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||
response.setContentType(MediaType.APPLICATION_JSON.toString());
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.getWriter().println(jsonInString);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.dbnt.kcscbackend.config.jwt;
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.util.EgovStringUtil;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import io.jsonwebtoken.MalformedJwtException;
|
||||
import io.jsonwebtoken.SignatureException;
|
||||
import io.jsonwebtoken.UnsupportedJwtException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
|
||||
import org.springframework.web.filter.OncePerRequestFilter;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* fileName : JwtAuthenticationFilter
|
||||
* author : crlee
|
||||
* date : 2023/06/11
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/06/11 crlee 최초 생성
|
||||
*/
|
||||
public class JwtAuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
@Autowired
|
||||
private EgovJwtTokenUtil jwtTokenUtil;
|
||||
public static final String HEADER_STRING = "Authorization";
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest req, HttpServletResponse res, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
boolean verificationFlag = true;
|
||||
|
||||
// step 1. request header에서 토큰을 가져온다.
|
||||
String jwtToken = EgovStringUtil.isNullToString(req.getHeader(HEADER_STRING));
|
||||
|
||||
|
||||
// step 2. 토큰에 내용이 있는지 확인해서 id값을 가져옴
|
||||
// Exception 핸들링 추가처리 (토큰 유효성, 토큰 변조 여부, 토큰 만료여부)
|
||||
// 내부적으로 parse하는 과정에서 해당 여부들이 검증됨
|
||||
String id = null;
|
||||
|
||||
try {
|
||||
|
||||
id = jwtTokenUtil.getUserIdFromToken(jwtToken);
|
||||
if (id == null) {
|
||||
logger.debug("jwtToken not validate");
|
||||
verificationFlag = false;
|
||||
}
|
||||
logger.debug("===>>> id = " + id);
|
||||
} catch (IllegalArgumentException | ExpiredJwtException | MalformedJwtException | UnsupportedJwtException | SignatureException e) {
|
||||
logger.debug("Unable to verify JWT Token: " + e.getMessage());
|
||||
verificationFlag = false;
|
||||
}
|
||||
|
||||
LoginVO loginVO = new LoginVO();
|
||||
if( verificationFlag ){
|
||||
logger.debug("jwtToken validated");
|
||||
loginVO.setId(id);
|
||||
loginVO.setUserSe( jwtTokenUtil.getUserSeFromToken(jwtToken) );
|
||||
loginVO.setUniqId( jwtTokenUtil.getInfoFromToken("uniqId",jwtToken) );
|
||||
loginVO.setOrgnztId( jwtTokenUtil.getInfoFromToken("orgnztId",jwtToken) );
|
||||
loginVO.setName( jwtTokenUtil.getInfoFromToken("name",jwtToken) );
|
||||
|
||||
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(loginVO, null,
|
||||
Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"))
|
||||
);
|
||||
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(req));
|
||||
SecurityContextHolder.getContext().setAuthentication(authentication);
|
||||
}
|
||||
|
||||
|
||||
chain.doFilter(req, res);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.dbnt.kcscbackend.config.security;
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.LoginVO;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
/**
|
||||
* fileName : CustomAuthenticationPrincipalResolver
|
||||
* author : crlee
|
||||
* date : 2023/07/13
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/07/13 crlee 최초 생성
|
||||
*/
|
||||
public class CustomAuthenticationPrincipalResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.hasParameterAnnotation(AuthenticationPrincipal.class) &&
|
||||
parameter.getParameterType().equals(LoginVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer,
|
||||
NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
||||
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null ||
|
||||
authentication.getPrincipal() == null ||
|
||||
"anonymousUser".equals(authentication.getPrincipal())
|
||||
) {
|
||||
return new LoginVO();
|
||||
}
|
||||
|
||||
return authentication.getPrincipal();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
package com.dbnt.kcscbackend.config.security;
|
||||
|
||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationEntryPoint;
|
||||
import com.dbnt.kcscbackend.config.jwt.JwtAuthenticationFilter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* fileName : SecurityConfig
|
||||
* author : crlee
|
||||
* date : 2023/06/10
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/06/10 crlee 최초 생성
|
||||
*/
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
//Http Methpd : Get 인증예외 List
|
||||
private String[] AUTH_GET_WHITELIST = {
|
||||
"/schedule/daily", //일별 일정 조회
|
||||
"/schedule/week", //주간 일정 조회
|
||||
"/schedule/{schdulId}", //일정 상세조회
|
||||
};
|
||||
|
||||
// 인증 예외 List
|
||||
private String[] AUTH_WHITELIST = {
|
||||
"/",
|
||||
"/login/**",
|
||||
"/auth/login-jwt",//JWT 로그인
|
||||
"/auth/login",//일반 로그인
|
||||
"/cmm/main/**.do", // 메인페이지
|
||||
"/cmm/fms/FileDown.do", //파일 다운로드
|
||||
"/cmm/fms/getImage.do", //갤러리 이미지보기
|
||||
|
||||
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회
|
||||
"/cop/bbs/selectBoardListAPI.do", //게시판 목록조회
|
||||
"/cop/bbs/selectBoardArticleAPI.do", //게시물 상세조회
|
||||
|
||||
/* swagger v2 */
|
||||
"/v2/api-docs",
|
||||
"/swagger-resources",
|
||||
"/swagger-resources/**",
|
||||
"/swagger-ui.html",
|
||||
"/swagger-ui/**",
|
||||
|
||||
/*기준코드 조회*/
|
||||
"/standardCode/**.do"
|
||||
};
|
||||
private static final String[] ORIGINS_WHITELIST = {
|
||||
"http://localhost:3000",
|
||||
};
|
||||
|
||||
@Bean
|
||||
public JwtAuthenticationFilter authenticationTokenFilterBean() throws Exception {
|
||||
return new JwtAuthenticationFilter();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
protected CorsConfigurationSource corsConfigurationSource() {
|
||||
CorsConfiguration configuration = new CorsConfiguration();
|
||||
|
||||
configuration.setAllowedOriginPatterns(Arrays.asList("*"));
|
||||
configuration.setAllowedMethods(Arrays.asList("HEAD","POST","GET","DELETE","PUT"));
|
||||
configuration.setAllowedOrigins(Arrays.asList(ORIGINS_WHITELIST));
|
||||
configuration.setAllowedHeaders(Arrays.asList("*"));
|
||||
configuration.setAllowCredentials(true);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", configuration);
|
||||
return source;
|
||||
}
|
||||
@Bean
|
||||
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||
|
||||
return http
|
||||
.csrf(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests(authorize -> authorize
|
||||
.antMatchers(AUTH_WHITELIST).permitAll()
|
||||
.antMatchers(HttpMethod.GET,AUTH_GET_WHITELIST).permitAll()
|
||||
.anyRequest().authenticated()
|
||||
).sessionManagement((sessionManagement) ->
|
||||
sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
|
||||
)
|
||||
.cors().and()
|
||||
.addFilterBefore(authenticationTokenFilterBean(), UsernamePasswordAuthenticationFilter.class)
|
||||
.exceptionHandling(exceptionHandlingConfigurer ->
|
||||
exceptionHandlingConfigurer
|
||||
.authenticationEntryPoint(new JwtAuthenticationEntryPoint())
|
||||
)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.dbnt.kcscbackend.config.security;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* fileName : WebMvcConfig
|
||||
* author : crlee
|
||||
* date : 2023/07/13
|
||||
* description :
|
||||
* ===========================================================
|
||||
* DATE AUTHOR NOTE
|
||||
* -----------------------------------------------------------
|
||||
* 2023/07/13 crlee 최초 생성
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(new CustomAuthenticationPrincipalResolver());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,240 @@
|
|||
/**
|
||||
* @Class Name : EgovNumberUtil.java
|
||||
* @Description : 숫자 데이터 처리 관련 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.02.13 이삼섭 최초 생성
|
||||
*
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009. 02. 13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
package com.dbnt.kcscbackend.config.util;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.security.SecureRandom;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author : 정완배
|
||||
* @since : 2023. 8. 9.
|
||||
* @version : 1.0
|
||||
*
|
||||
* @package : egovframework.let.utl.fcc.service
|
||||
* @filename : EgovNumberUtil.java
|
||||
* @modificationInformation
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ---------- ---------- ----------------------
|
||||
* 2023. 8. 9. 정완배 주석추가
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
public class EgovNumberUtil {
|
||||
|
||||
private static SecureRandom rnd = new SecureRandom();
|
||||
|
||||
/**
|
||||
* 특정숫자 집합에서 랜덤 숫자를 구하는 기능 시작숫자와 종료숫자 사이에서 구한 랜덤 숫자를 반환한다
|
||||
*
|
||||
* @param startNum - 시작숫자
|
||||
* @param endNum - 종료숫자
|
||||
* @return 랜덤숫자
|
||||
* @see
|
||||
*/
|
||||
public static int getRandomNum(int startNum, int endNum) {
|
||||
int randomNum = 0;
|
||||
|
||||
do {
|
||||
// 종료숫자내에서 랜덤 숫자를 발생시킨다.
|
||||
randomNum = rnd.nextInt(endNum + 1);
|
||||
} while (randomNum < startNum); // 랜덤 숫자가 시작숫자보다 작을경우 다시 랜덤숫자를 발생시킨다.
|
||||
|
||||
return randomNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정 숫자 집합에서 특정 숫자가 있는지 체크하는 기능 12345678에서 7이 있는지 없는지 체크하는 기능을 제공함
|
||||
*
|
||||
* @param sourceInt - 특정숫자집합
|
||||
* @param searchInt - 검색숫자
|
||||
* @return 존재여부
|
||||
* @see
|
||||
*/
|
||||
public static Boolean getNumSearchCheck(int sourceInt, int searchInt) {
|
||||
String sourceStr = String.valueOf(sourceInt);
|
||||
String searchStr = String.valueOf(searchInt);
|
||||
|
||||
// 특정숫자가 존재하는지 하여 위치값을 리턴한다. 없을 시 -1
|
||||
if (sourceStr.indexOf(searchStr) == -1) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 숫자타입을 문자열로 변환하는 기능 숫자 20081212를 문자열 '20081212'로 변환하는 기능
|
||||
*
|
||||
* @param srcNumber - 숫자
|
||||
* @return 문자열
|
||||
* @see
|
||||
*/
|
||||
public static String getNumToStrCnvr(int srcNumber) {
|
||||
String rtnStr = null;
|
||||
|
||||
rtnStr = String.valueOf(srcNumber);
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 숫자타입을 데이트 타입으로 변환하는 기능
|
||||
* 숫자 20081212를 데이트타입 '2008-12-12'로 변환하는 기능
|
||||
* @param srcNumber - 숫자
|
||||
* @return String
|
||||
* @see
|
||||
*/
|
||||
public static String getNumToDateCnvr(int srcNumber) {
|
||||
|
||||
String pattern = null;
|
||||
String cnvrStr = null;
|
||||
|
||||
String srcStr = String.valueOf(srcNumber);
|
||||
|
||||
// Date 형태인 8자리 및 14자리만 정상처리
|
||||
if (srcStr.length() != 8 && srcStr.length() != 14) {
|
||||
throw new IllegalArgumentException("Invalid Number: " + srcStr + " Length=" + srcStr.trim().length());
|
||||
}
|
||||
|
||||
if (srcStr.length() == 8) {
|
||||
pattern = "yyyyMMdd";
|
||||
} else if (srcStr.length() == 14) {
|
||||
pattern = "yyyyMMddhhmmss";
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat(pattern, Locale.KOREA);
|
||||
|
||||
Date cnvrDate = null;
|
||||
|
||||
try {
|
||||
cnvrDate = dateFormatter.parse(srcStr);
|
||||
} catch (ParseException e) {
|
||||
log.error("ERROR parsing", e.getMessage());
|
||||
}
|
||||
|
||||
cnvrStr = String.format("%1$tY-%1$tm-%1$td", cnvrDate);
|
||||
|
||||
return cnvrStr;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 체크할 숫자 중에서 숫자인지 아닌지 체크하는 기능
|
||||
* 숫자이면 True, 아니면 False를 반환한다
|
||||
* @param checkStr - 체크문자열
|
||||
* @return 숫자여부
|
||||
* @see
|
||||
*/
|
||||
public static Boolean getNumberValidCheck(String checkStr) {
|
||||
|
||||
int i;
|
||||
//String sourceStr = String.valueOf(sourceInt);
|
||||
|
||||
int checkStrLt = checkStr.length();
|
||||
|
||||
for (i = 0; i < checkStrLt; i++) {
|
||||
|
||||
// 아스키코드값( '0'-> 48, '9' -> 57)
|
||||
if (checkStr.charAt(i) > 47 && checkStr.charAt(i) < 58) {
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정숫자를 다른 숫자로 치환하는 기능 숫자 12345678에서 123를 999로 변환하는 기능을 제공(99945678)
|
||||
*
|
||||
* @param srcNumber - 숫자집합
|
||||
* @param cnvrSrcNumber - 원래숫자
|
||||
* @param cnvrTrgtNumber - 치환숫자
|
||||
* @return 치환숫자
|
||||
* @see
|
||||
*/
|
||||
|
||||
public static int getNumberCnvr(int srcNumber, int cnvrSrcNumber, int cnvrTrgtNumber) {
|
||||
|
||||
// 입력받은 숫자를 문자열로 변환
|
||||
String source = String.valueOf(srcNumber);
|
||||
String subject = String.valueOf(cnvrSrcNumber);
|
||||
String object = String.valueOf(cnvrTrgtNumber);
|
||||
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
|
||||
// 원본숫자에서 변환대상숫자의 위치를 찾는다.
|
||||
while (source.indexOf(subject) >= 0) {
|
||||
preStr = source.substring(0, source.indexOf(subject)); // 변환대상숫자 위치까지 숫자를 잘라낸다
|
||||
nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length());
|
||||
source = nextStr;
|
||||
rtnStr.append(preStr).append(object); // 변환대상위치 숫자에 변환할 숫자를 붙여준다.
|
||||
}
|
||||
rtnStr.append(nextStr); // 변환대상 숫자 이후 숫자를 붙여준다.
|
||||
|
||||
return Integer.parseInt(rtnStr.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정숫자가 실수인지, 정수인지, 음수인지 체크하는 기능 123이 실수인지, 정수인지, 음수인지 체크하는 기능을 제공함
|
||||
*
|
||||
* @param srcNumber - 숫자집합
|
||||
* @return -1(음수), 0(정수), 1(실수)
|
||||
* @see
|
||||
*/
|
||||
public static int checkRlnoInteger(double srcNumber) {
|
||||
|
||||
// byte 1바이트 ▶소수점이 없는 숫자로, 범위 -2^7 ~ 2^7 -1
|
||||
// short 2바이트 ▶소수점이 없는 숫자로, 범위 -2^15 ~ 2^15 -1
|
||||
// int 4바이트 ▶소수점이 없는 숫자로, 범위 -2^31 ~ 2^31 - 1
|
||||
// long 8바이트 ▶소수점이 없는 숫자로, 범위 -2^63 ~ 2^63-1
|
||||
|
||||
// float 4바이트 ▶소수점이 있는 숫자로, 끝에 F 또는 f 가 붙는 숫자 (예:3.14f)
|
||||
// double 8바이트 ▶소수점이 있는 숫자로, 끝에 아무것도 붙지 않는 숫자 (예:3.14)
|
||||
// ▶소수점이 있는 숫자로, 끝에 D 또는 d 가 붙는 숫자(예:3.14d)
|
||||
|
||||
String cnvrString = null;
|
||||
|
||||
if (srcNumber < 0) {
|
||||
return -1;
|
||||
} else {
|
||||
cnvrString = String.valueOf(srcNumber);
|
||||
|
||||
if (cnvrString.indexOf(".") == -1) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,888 @@
|
|||
/**
|
||||
* @Class Name : EgovStringUtil.java
|
||||
* @Description : 문자열 데이터 처리 관련 유틸리티
|
||||
* @Modification Information
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.01.13 박정규 최초 생성
|
||||
* 2009.02.13 이삼섭 내용 추가
|
||||
*
|
||||
* @author 공통 서비스 개발팀 박정규
|
||||
* @since 2009. 01. 13
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
*/
|
||||
|
||||
package com.dbnt.kcscbackend.config.util;
|
||||
|
||||
/*
|
||||
* 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.math.BigDecimal;
|
||||
import java.security.SecureRandom;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
public class EgovStringUtil {
|
||||
|
||||
/**
|
||||
* 빈 문자열 <code>""</code>.
|
||||
*/
|
||||
public static final String EMPTY = "";
|
||||
|
||||
/**
|
||||
* 랜덤 객체
|
||||
*/
|
||||
public static SecureRandom rnd = new SecureRandom();
|
||||
|
||||
/**
|
||||
* <p>Padding을 할 수 있는 최대 수치</p>
|
||||
*/
|
||||
// private static final int PAD_LIMIT = 8192;
|
||||
/**
|
||||
* <p>An array of <code>String</code>s used for padding.</p>
|
||||
* <p>Used for efficient space padding. The length of each String expands as needed.</p>
|
||||
*/
|
||||
/*
|
||||
private static final String[] PADDING = new String[Character.MAX_VALUE];
|
||||
|
||||
static {
|
||||
// space padding is most common, start with 64 chars
|
||||
PADDING[32] = " ";
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* 문자열이 지정한 길이를 초과했을때 지정한길이에다가 해당 문자열을 붙여주는 메서드.
|
||||
* @param source 원본 문자열 배열
|
||||
* @param output 더할문자열
|
||||
* @param slength 지정길이
|
||||
* @return 지정길이로 잘라서 더할분자열 합친 문자열
|
||||
*/
|
||||
public static String cutString(String source, String output, int slength) {
|
||||
String returnVal = null;
|
||||
if (source != null) {
|
||||
if (source.length() > slength) {
|
||||
returnVal = source.substring(0, slength) + output;
|
||||
} else {
|
||||
returnVal = source;
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열이 지정한 길이를 초과했을때 해당 문자열을 삭제하는 메서드
|
||||
* @param source 원본 문자열 배열
|
||||
* @param slength 지정길이
|
||||
* @return 지정길이로 잘라서 더할분자열 합친 문자열
|
||||
*/
|
||||
public static String cutString(String source, int slength) {
|
||||
String result = null;
|
||||
if (source != null) {
|
||||
if (source.length() > slength) {
|
||||
result = source.substring(0, slength);
|
||||
} else {
|
||||
result = source;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* String이 비었거나("") 혹은 null 인지 검증한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.isEmpty(null) = true
|
||||
* StringUtil.isEmpty("") = true
|
||||
* StringUtil.isEmpty(" ") = false
|
||||
* StringUtil.isEmpty("bob") = false
|
||||
* StringUtil.isEmpty(" bob ") = false
|
||||
* </pre>
|
||||
*
|
||||
* @param str - 체크 대상 스트링오브젝트이며 null을 허용함
|
||||
* @return <code>true</code> - 입력받은 String 이 빈 문자열 또는 null인 경우
|
||||
*/
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || str.length() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>기준 문자열에 포함된 모든 대상 문자(char)를 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.remove(null, *) = null
|
||||
* StringUtil.remove("", *) = ""
|
||||
* StringUtil.remove("queued", 'u') = "qeed"
|
||||
* StringUtil.remove("queued", 'z') = "queued"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @param remove 입력받는 문자열에서 제거할 대상 문자열
|
||||
* @return 제거대상 문자열이 제거된 입력문자열. 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String remove(String str, char remove) {
|
||||
if (isEmpty(str) || str.indexOf(remove) == -1) {
|
||||
return str;
|
||||
}
|
||||
char[] chars = str.toCharArray();
|
||||
int pos = 0;
|
||||
for (int i = 0; i < chars.length; i++) {
|
||||
if (chars[i] != remove) {
|
||||
chars[pos++] = chars[i];
|
||||
}
|
||||
}
|
||||
return new String(chars, 0, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열 내부의 콤마 character(,)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeCommaChar(null) = null
|
||||
* StringUtil.removeCommaChar("") = ""
|
||||
* StringUtil.removeCommaChar("asdfg,qweqe") = "asdfgqweqe"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @return " , "가 제거된 입력문자열
|
||||
* 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String removeCommaChar(String str) {
|
||||
return remove(str, ',');
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열 내부의 마이너스 character(-)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeMinusChar(null) = null
|
||||
* StringUtil.removeMinusChar("") = ""
|
||||
* StringUtil.removeMinusChar("a-sdfg-qweqe") = "asdfgqweqe"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 입력받는 기준 문자열
|
||||
* @return " - "가 제거된 입력문자열
|
||||
* 입력문자열이 null인 경우 출력문자열은 null
|
||||
*/
|
||||
public static String removeMinusChar(String str) {
|
||||
return remove(str, '-');
|
||||
}
|
||||
|
||||
/**
|
||||
* 원본 문자열의 포함된 특정 문자열을 새로운 문자열로 변환하는 메서드
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열
|
||||
*/
|
||||
public static String replace(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
String srcStr = source;
|
||||
|
||||
while (srcStr.indexOf(subject) >= 0) {
|
||||
preStr = srcStr.substring(0, srcStr.indexOf(subject));
|
||||
nextStr = srcStr.substring(srcStr.indexOf(subject) + subject.length(), srcStr.length());
|
||||
srcStr = nextStr;
|
||||
rtnStr.append(preStr).append(object);
|
||||
}
|
||||
rtnStr.append(nextStr);
|
||||
return rtnStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 원본 문자열의 포함된 특정 문자열 첫번째 한개만 새로운 문자열로 변환하는 메서드
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열 / source 특정문자열이 없는 경우 원본 문자열
|
||||
*/
|
||||
public static String replaceOnce(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
if (source.indexOf(subject) >= 0) {
|
||||
preStr = source.substring(0, source.indexOf(subject));
|
||||
nextStr = source.substring(source.indexOf(subject) + subject.length(), source.length());
|
||||
rtnStr.append(preStr).append(object).append(nextStr);
|
||||
return rtnStr.toString();
|
||||
} else {
|
||||
return source;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>subject</code>에 포함된 각각의 문자를 object로 변환한다.
|
||||
*
|
||||
* @param source 원본 문자열
|
||||
* @param subject 원본 문자열에 포함된 특정 문자열
|
||||
* @param object 변환할 문자열
|
||||
* @return sb.toString() 새로운 문자열로 변환된 문자열
|
||||
*/
|
||||
public static String replaceChar(String source, String subject, String object) {
|
||||
StringBuffer rtnStr = new StringBuffer();
|
||||
String preStr = "";
|
||||
String nextStr = source;
|
||||
String srcStr = source;
|
||||
|
||||
char chA;
|
||||
|
||||
for (int i = 0; i < subject.length(); i++) {
|
||||
chA = subject.charAt(i);
|
||||
|
||||
if (srcStr.indexOf(chA) >= 0) {
|
||||
preStr = srcStr.substring(0, srcStr.indexOf(chA));
|
||||
nextStr = srcStr.substring(srcStr.indexOf(chA) + 1, srcStr.length());
|
||||
srcStr = rtnStr.append(preStr).append(object).append(nextStr).toString();
|
||||
}
|
||||
}
|
||||
|
||||
return srcStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p><code>str</code> 중 <code>searchStr</code>의 시작(index) 위치를 반환.</p>
|
||||
*
|
||||
* <p>입력값 중 <code>null</code>이 있을 경우 <code>-1</code>을 반환.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.indexOf(null, *) = -1
|
||||
* StringUtil.indexOf(*, null) = -1
|
||||
* StringUtil.indexOf("", "") = 0
|
||||
* StringUtil.indexOf("aabaabaa", "a") = 0
|
||||
* StringUtil.indexOf("aabaabaa", "b") = 2
|
||||
* StringUtil.indexOf("aabaabaa", "ab") = 1
|
||||
* StringUtil.indexOf("aabaabaa", "") = 0
|
||||
* </pre>
|
||||
*
|
||||
* @param str 검색 문자열
|
||||
* @param searchStr 검색 대상문자열
|
||||
* @return 검색 문자열 중 검색 대상문자열이 있는 시작 위치 검색대상 문자열이 없거나 null인 경우 -1
|
||||
*/
|
||||
public static int indexOf(String str, String searchStr) {
|
||||
if (str == null || searchStr == null) {
|
||||
return -1;
|
||||
}
|
||||
return str.indexOf(searchStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
|
||||
* <code>sourStr</code>과 <code>compareStr</code>의 값이 같으면
|
||||
* <code>returStr</code>을 반환하며, 다르면 <code>defaultStr</code>을 반환한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.decode(null, null, "foo", "bar")= "foo"
|
||||
* StringUtil.decode("", null, "foo", "bar") = "bar"
|
||||
* StringUtil.decode(null, "", "foo", "bar") = "bar"
|
||||
* StringUtil.decode("하이", "하이", null, "bar") = null
|
||||
* StringUtil.decode("하이", "하이 ", "foo", null) = null
|
||||
* StringUtil.decode("하이", "하이", "foo", "bar") = "foo"
|
||||
* StringUtil.decode("하이", "하이 ", "foo", "bar") = "bar"
|
||||
* </pre>
|
||||
*
|
||||
* @param sourceStr 비교할 문자열
|
||||
* @param compareStr 비교 대상 문자열
|
||||
* @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
|
||||
* @param defaultStr sourceStr와 compareStr의 값이 다를 때 반환할 문자열
|
||||
* @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
|
||||
* <br/>다르면 defaultStr을 반환한다.
|
||||
*/
|
||||
public static String decode(String sourceStr, String compareStr, String returnStr, String defaultStr) {
|
||||
if (sourceStr == null && compareStr == null) {
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
else if (sourceStr != null && sourceStr.trim().equals(compareStr)) {
|
||||
return returnStr;
|
||||
}
|
||||
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>오라클의 decode 함수와 동일한 기능을 가진 메서드이다.
|
||||
* <code>sourStr</code>과 <code>compareStr</code>의 값이 같으면
|
||||
* <code>returStr</code>을 반환하며, 다르면 <code>sourceStr</code>을 반환한다.
|
||||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.decode(null, null, "foo") = "foo"
|
||||
* StringUtil.decode("", null, "foo") = ""
|
||||
* StringUtil.decode(null, "", "foo") = null
|
||||
* StringUtil.decode("하이", "하이", "foo") = "foo"
|
||||
* StringUtil.decode("하이", "하이 ", "foo") = "하이"
|
||||
* StringUtil.decode("하이", "바이", "foo") = "하이"
|
||||
* </pre>
|
||||
*
|
||||
* @param sourceStr 비교할 문자열
|
||||
* @param compareStr 비교 대상 문자열
|
||||
* @param returnStr sourceStr와 compareStr의 값이 같을 때 반환할 문자열
|
||||
* @return sourceStr과 compareStr의 값이 동일(equal)할 때 returnStr을 반환하며,
|
||||
* <br/>다르면 sourceStr을 반환한다.
|
||||
*/
|
||||
public static String decode(String sourceStr, String compareStr, String returnStr) {
|
||||
return decode(sourceStr, compareStr, returnStr, sourceStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 객체가 null인지 확인하고 null인 경우 "" 로 바꾸는 메서드
|
||||
* @param object 원본 객체
|
||||
* @return resultVal 문자열
|
||||
*/
|
||||
public static String isNullToString(Object object) {
|
||||
String string = "";
|
||||
|
||||
if (object != null) {
|
||||
string = object.toString().trim();
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static String nullConvert(Object src) {
|
||||
//if (src != null && src.getClass().getName().equals("java.math.BigDecimal")) {
|
||||
if (src != null && src instanceof BigDecimal) {
|
||||
return ((BigDecimal)src).toString();
|
||||
}
|
||||
|
||||
if (src == null || src.equals("null")) {
|
||||
return "";
|
||||
} else {
|
||||
return ((String)src).trim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static String nullConvert(String src) {
|
||||
|
||||
if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
|
||||
return "";
|
||||
} else {
|
||||
return src.trim();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 "0"로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 "0"로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static int zeroConvert(Object src) {
|
||||
|
||||
if (src == null || src.equals("null")) {
|
||||
return 0;
|
||||
} else {
|
||||
return Integer.parseInt(((String)src).trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*<pre>
|
||||
* 인자로 받은 String이 null일 경우 ""로 리턴한다.
|
||||
* @param src null값일 가능성이 있는 String 값.
|
||||
* @return 만약 String이 null 값일 경우 ""로 바꾼 String 값.
|
||||
*</pre>
|
||||
*/
|
||||
public static int zeroConvert(String src) {
|
||||
|
||||
if (src == null || src.equals("null") || "".equals(src) || " ".equals(src)) {
|
||||
return 0;
|
||||
} else {
|
||||
return Integer.parseInt(src.trim());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>문자열에서 {@link Character#isWhitespace(char)}에 정의된
|
||||
* 모든 공백문자를 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.removeWhitespace(null) = null
|
||||
* StringUtil.removeWhitespace("") = ""
|
||||
* StringUtil.removeWhitespace("abc") = "abc"
|
||||
* StringUtil.removeWhitespace(" ab c ") = "abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 공백문자가 제거도어야 할 문자열
|
||||
* @return the 공백문자가 제거된 문자열, null이 입력되면 <code>null</code>이 리턴
|
||||
*/
|
||||
public static String removeWhitespace(String str) {
|
||||
if (isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
int sz = str.length();
|
||||
char[] chs = new char[sz];
|
||||
int count = 0;
|
||||
for (int i = 0; i < sz; i++) {
|
||||
if (!Character.isWhitespace(str.charAt(i))) {
|
||||
chs[count++] = str.charAt(i);
|
||||
}
|
||||
}
|
||||
if (count == sz) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return new String(chs, 0, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Html 코드가 들어간 문서를 표시할때 태그에 손상없이 보이기 위한 메서드
|
||||
*
|
||||
* @param strString
|
||||
* @return HTML 태그를 치환한 문자열
|
||||
*/
|
||||
public static String checkHtmlView(String strString) {
|
||||
String strNew = "";
|
||||
|
||||
StringBuffer strTxt = new StringBuffer("");
|
||||
|
||||
char chrBuff;
|
||||
int len = strString.length();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
chrBuff = strString.charAt(i);
|
||||
|
||||
switch (chrBuff) {
|
||||
case '<':
|
||||
strTxt.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strTxt.append(">");
|
||||
break;
|
||||
case '"':
|
||||
strTxt.append(""");
|
||||
break;
|
||||
case 10:
|
||||
strTxt.append("<br>");
|
||||
break;
|
||||
case ' ':
|
||||
strTxt.append(" ");
|
||||
break;
|
||||
//case '&' :
|
||||
//strTxt.append("&");
|
||||
//break;
|
||||
default:
|
||||
strTxt.append(chrBuff);
|
||||
}
|
||||
}
|
||||
|
||||
strNew = strTxt.toString();
|
||||
|
||||
return strNew;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 지정한 분리자에 의해 배열로 리턴하는 메서드.
|
||||
* @param source 원본 문자열
|
||||
* @param separator 분리자
|
||||
* @return result 분리자로 나뉘어진 문자열 배열
|
||||
*/
|
||||
public static String[] split(String source, String separator) throws NullPointerException {
|
||||
String[] returnVal = null;
|
||||
int cnt = 1;
|
||||
|
||||
int index = source.indexOf(separator);
|
||||
int index0 = 0;
|
||||
while (index >= 0) {
|
||||
cnt++;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
}
|
||||
returnVal = new String[cnt];
|
||||
cnt = 0;
|
||||
index = source.indexOf(separator);
|
||||
while (index >= 0) {
|
||||
returnVal[cnt] = source.substring(index0, index);
|
||||
index0 = index + 1;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
cnt++;
|
||||
}
|
||||
returnVal[cnt] = source.substring(index0);
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>{@link String#toLowerCase()}를 이용하여 소문자로 변환한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.lowerCase(null) = null
|
||||
* StringUtil.lowerCase("") = ""
|
||||
* StringUtil.lowerCase("aBc") = "abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 소문자로 변환되어야 할 문자열
|
||||
* @return 소문자로 변환된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String lowerCase(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return str.toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>{@link String#toUpperCase()}를 이용하여 대문자로 변환한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.upperCase(null) = null
|
||||
* StringUtil.upperCase("") = ""
|
||||
* StringUtil.upperCase("aBc") = "ABC"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 대문자로 변환되어야 할 문자열
|
||||
* @return 대문자로 변환된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String upperCase(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return str.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 앞쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.stripStart(null, *) = null
|
||||
* StringUtil.stripStart("", *) = ""
|
||||
* StringUtil.stripStart("abc", "") = "abc"
|
||||
* StringUtil.stripStart("abc", null) = "abc"
|
||||
* StringUtil.stripStart(" abc", null) = "abc"
|
||||
* StringUtil.stripStart("abc ", null) = "abc "
|
||||
* StringUtil.stripStart(" abc ", null) = "abc "
|
||||
* StringUtil.stripStart("yxabc ", "xyz") = "abc "
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String stripStart(String str, String stripChars) {
|
||||
int strLen;
|
||||
if (str == null || (strLen = str.length()) == 0) {
|
||||
return str;
|
||||
}
|
||||
int start = 0;
|
||||
if (stripChars == null) {
|
||||
while ((start != strLen) && Character.isWhitespace(str.charAt(start))) {
|
||||
start++;
|
||||
}
|
||||
} else if (stripChars.length() == 0) {
|
||||
return str;
|
||||
} else {
|
||||
while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) {
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
return str.substring(start);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 뒤쪽에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.stripEnd(null, *) = null
|
||||
* StringUtil.stripEnd("", *) = ""
|
||||
* StringUtil.stripEnd("abc", "") = "abc"
|
||||
* StringUtil.stripEnd("abc", null) = "abc"
|
||||
* StringUtil.stripEnd(" abc", null) = " abc"
|
||||
* StringUtil.stripEnd("abc ", null) = "abc"
|
||||
* StringUtil.stripEnd(" abc ", null) = " abc"
|
||||
* StringUtil.stripEnd(" abcyx", "xyz") = " abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String stripEnd(String str, String stripChars) {
|
||||
int end;
|
||||
if (str == null || (end = str.length()) == 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
if (stripChars == null) {
|
||||
while ((end != 0) && Character.isWhitespace(str.charAt(end - 1))) {
|
||||
end--;
|
||||
}
|
||||
} else if (stripChars.length() == 0) {
|
||||
return str;
|
||||
} else {
|
||||
while ((end != 0) && (stripChars.indexOf(str.charAt(end - 1)) != -1)) {
|
||||
end--;
|
||||
}
|
||||
}
|
||||
|
||||
return str.substring(0, end);
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>입력된 String의 앞, 뒤에서 두번째 인자로 전달된 문자(stripChars)를 모두 제거한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.strip(null, *) = null
|
||||
* StringUtil.strip("", *) = ""
|
||||
* StringUtil.strip("abc", null) = "abc"
|
||||
* StringUtil.strip(" abc", null) = "abc"
|
||||
* StringUtil.strip("abc ", null) = "abc"
|
||||
* StringUtil.strip(" abc ", null) = "abc"
|
||||
* StringUtil.strip(" abcyx", "xyz") = " abc"
|
||||
* </pre>
|
||||
*
|
||||
* @param str 지정된 문자가 제거되어야 할 문자열
|
||||
* @param stripChars 제거대상 문자열
|
||||
* @return 지정된 문자가 제거된 문자열, null이 입력되면 <code>null</code> 리턴
|
||||
*/
|
||||
public static String strip(String str, String stripChars) {
|
||||
if (isEmpty(str)) {
|
||||
return str;
|
||||
}
|
||||
|
||||
String srcStr = str;
|
||||
srcStr = stripStart(srcStr, stripChars);
|
||||
|
||||
return stripEnd(srcStr, stripChars);
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 지정한 분리자에 의해 지정된 길이의 배열로 리턴하는 메서드.
|
||||
* @param source 원본 문자열
|
||||
* @param separator 분리자
|
||||
* @param arraylength 배열 길이
|
||||
* @return 분리자로 나뉘어진 문자열 배열
|
||||
*/
|
||||
public static String[] split(String source, String separator, int arraylength) throws NullPointerException {
|
||||
String[] returnVal = new String[arraylength];
|
||||
int cnt = 0;
|
||||
int index0 = 0;
|
||||
int index = source.indexOf(separator);
|
||||
while (index >= 0 && cnt < (arraylength - 1)) {
|
||||
returnVal[cnt] = source.substring(index0, index);
|
||||
index0 = index + 1;
|
||||
index = source.indexOf(separator, index + 1);
|
||||
cnt++;
|
||||
}
|
||||
returnVal[cnt] = source.substring(index0);
|
||||
if (cnt < (arraylength - 1)) {
|
||||
for (int i = cnt + 1; i < arraylength; i++) {
|
||||
returnVal[i] = "";
|
||||
}
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열 A에서 Z사이의 랜덤 문자열을 구하는 기능을 제공 시작문자열과 종료문자열 사이의 랜덤 문자열을 구하는 기능
|
||||
*
|
||||
* @param startChr
|
||||
* - 첫 문자
|
||||
* @param endChr
|
||||
* - 마지막문자
|
||||
* @return 랜덤문자
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getRandomStr(char startChr, char endChr) {
|
||||
|
||||
int randomInt;
|
||||
String randomStr = null;
|
||||
|
||||
// 시작문자 및 종료문자를 아스키숫자로 변환한다.
|
||||
int startInt = Integer.valueOf(startChr);
|
||||
int endInt = Integer.valueOf(endChr);
|
||||
|
||||
// 시작문자열이 종료문자열보가 클경우
|
||||
if (startInt > endInt) {
|
||||
throw new IllegalArgumentException("Start String: " + startChr + " End String: " + endChr);
|
||||
}
|
||||
|
||||
do {
|
||||
// 시작문자 및 종료문자 중에서 랜덤 숫자를 발생시킨다.
|
||||
randomInt = rnd.nextInt(endInt + 1);
|
||||
} while (randomInt < startInt); // 입력받은 문자 'A'(65)보다 작으면 다시 랜덤 숫자 발생.
|
||||
|
||||
// 랜덤 숫자를 문자로 변환 후 스트링으로 다시 변환
|
||||
randomStr = (char)randomInt + "";
|
||||
|
||||
// 랜덤문자열를 리턴
|
||||
return randomStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 문자열을 다양한 문자셋(EUC-KR[KSC5601],UTF-8..)을 사용하여 인코딩하는 기능 역으로 디코딩하여 원래의 문자열을
|
||||
* 복원하는 기능을 제공함 String temp = new String(문자열.getBytes("바꾸기전 인코딩"),"바꿀 인코딩");
|
||||
* String temp = new String(문자열.getBytes("8859_1"),"KSC5601"); => UTF-8 에서
|
||||
* EUC-KR
|
||||
*
|
||||
* @param srcString
|
||||
* - 문자열
|
||||
* @param srcCharsetNm
|
||||
* - 원래 CharsetNm
|
||||
* @param charsetNm
|
||||
* - CharsetNm
|
||||
* @return 인(디)코딩 문자열
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getEncdDcd(String srcString, String srcCharsetNm, String cnvrCharsetNm) {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
if (srcString == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
rtnStr = new String(srcString.getBytes(srcCharsetNm), cnvrCharsetNm);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
rtnStr = null;
|
||||
}
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특수문자를 웹 브라우저에서 정상적으로 보이기 위해 특수문자를 처리('<' -> & lT)하는 기능이다
|
||||
* @param srcString - '<'
|
||||
* @return 변환문자열('<' -> "<"
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getSpclStrCnvr(String srcString) {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
StringBuffer strTxt = new StringBuffer("");
|
||||
|
||||
char chrBuff;
|
||||
int len = srcString.length();
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
chrBuff = srcString.charAt(i);
|
||||
|
||||
switch (chrBuff) {
|
||||
case '<':
|
||||
strTxt.append("<");
|
||||
break;
|
||||
case '>':
|
||||
strTxt.append(">");
|
||||
break;
|
||||
case '&':
|
||||
strTxt.append("&");
|
||||
break;
|
||||
default:
|
||||
strTxt.append(chrBuff);
|
||||
}
|
||||
}
|
||||
|
||||
rtnStr = strTxt.toString();
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 응용어플리케이션에서 고유값을 사용하기 위해 시스템에서17자리의TIMESTAMP값을 구하는 기능
|
||||
*
|
||||
* @param
|
||||
* @return Timestamp 값
|
||||
* @exception MyException
|
||||
* @see
|
||||
*/
|
||||
public static String getTimeStamp() {
|
||||
|
||||
String rtnStr = null;
|
||||
|
||||
// 문자열로 변환하기 위한 패턴 설정(년도-월-일 시:분:초:초(자정이후 초))
|
||||
String pattern = "yyyyMMddhhmmssSSS";
|
||||
|
||||
SimpleDateFormat sdfCurrent = new SimpleDateFormat(pattern, Locale.KOREA);
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
rtnStr = sdfCurrent.format(ts.getTime());
|
||||
|
||||
return rtnStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* html의 특수문자를 표현하기 위해
|
||||
*
|
||||
* @param srcString
|
||||
* @return String
|
||||
* @exception Exception
|
||||
* @see
|
||||
*/
|
||||
public static String getHtmlStrCnvr(String srcString) {
|
||||
|
||||
String tmpString = srcString;
|
||||
|
||||
tmpString = tmpString.replaceAll("<", "<");
|
||||
tmpString = tmpString.replaceAll(">", ">");
|
||||
tmpString = tmpString.replaceAll("&", "&");
|
||||
tmpString = tmpString.replaceAll(" ", " ");
|
||||
tmpString = tmpString.replaceAll("'", "\'");
|
||||
tmpString = tmpString.replaceAll(""", "\"");
|
||||
|
||||
return tmpString;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>날짜 형식의 문자열 내부에 마이너스 character(-)를 추가한다.</p>
|
||||
*
|
||||
* <pre>
|
||||
* StringUtil.addMinusChar("20100901") = "2010-09-01"
|
||||
* </pre>
|
||||
*
|
||||
* @param date 입력받는 문자열
|
||||
* @return " - "가 추가된 입력문자열
|
||||
*/
|
||||
public static String addMinusChar(String date) {
|
||||
if (date.length() == 8) {
|
||||
return date.substring(0, 4).concat("-").concat(date.substring(4, 6)).concat("-")
|
||||
.concat(date.substring(6, 8));
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
package com.dbnt.kcscbackend.standardCode;
|
||||
|
||||
import com.dbnt.kcscbackend.config.common.BaseController;
|
||||
import com.dbnt.kcscbackend.config.common.LoginVO;
|
||||
import com.dbnt.kcscbackend.config.common.ResponseCode;
|
||||
import com.dbnt.kcscbackend.config.common.ResultVO;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfoVO;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeListService;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeService;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeVO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.egovframe.rte.fdl.property.EgovPropertyService;
|
||||
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 건설기준코드 관리를 위한 컨트롤러 클래스
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023.10.11 최강석 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/standardCode")
|
||||
@Tag(name="StandardCodeController",description = "건설기준코드 관리 컨트롤러")
|
||||
public class StandardCodeController extends BaseController {
|
||||
|
||||
@Resource(name = "propertiesService")
|
||||
protected EgovPropertyService propertyService;
|
||||
|
||||
private final StandardCodeService standardCodeService;
|
||||
|
||||
private final StandardCodeListService standardCodeListService;
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준코드 트리 조회",
|
||||
description = "건설기준코드 트리 조회",
|
||||
tags = {"StandardCodeController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@PostMapping(value = "/getCodeTree.do", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO getCodeTree(@RequestBody StandardCodeVO param, @AuthenticationPrincipal LoginVO user)
|
||||
throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("codeTree", standardCodeService.selectStandardCodeTree());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준코드 내용 조회",
|
||||
description = "건설기준코드 내용 조회",
|
||||
tags = {"StandardCodeController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@PostMapping(value = "/getCodeDetailInfo.do", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO getCodeDetailInfo(@RequestBody StandardCodeVO param, @AuthenticationPrincipal LoginVO user)
|
||||
throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("document", standardCodeService.selectStandardCodeDocument(param));
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
|
||||
|
||||
@Operation(
|
||||
summary = "건설기준코드 리스트 조회",
|
||||
description = "건설기준코드 리스트 조회",
|
||||
tags = {"StandardCodeController"}
|
||||
)
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "200", description = "조회 성공"),
|
||||
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
|
||||
})
|
||||
@PostMapping(value = "/selectStandardCodeList.do", consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResultVO selectStandardCodeList(@RequestBody TnDocumentInfoVO tnDocumentInfoVO, @AuthenticationPrincipal LoginVO user)
|
||||
throws Exception {
|
||||
ResultVO resultVO = new ResultVO();
|
||||
|
||||
PaginationInfo paginationInfo = new PaginationInfo();
|
||||
paginationInfo.setCurrentPageNo(tnDocumentInfoVO.getPageIndex());
|
||||
paginationInfo.setRecordCountPerPage(propertyService.getInt("Globals.pageUnit"));
|
||||
paginationInfo.setPageSize(propertyService.getInt("Globals.pageSize"));
|
||||
|
||||
System.out.println("@@@ pageIndex : " + tnDocumentInfoVO.getPageIndex());
|
||||
|
||||
tnDocumentInfoVO.setFirstIndex(paginationInfo.getFirstRecordIndex());
|
||||
tnDocumentInfoVO.setLastIndex(paginationInfo.getLastRecordIndex());
|
||||
tnDocumentInfoVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
|
||||
|
||||
Map<String, Object> resultMap = standardCodeListService.selectStandardCodeList(tnDocumentInfoVO);
|
||||
|
||||
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
|
||||
paginationInfo.setTotalRecordCount(totCnt);
|
||||
|
||||
resultMap.put("tnDocumentInfoVO", tnDocumentInfoVO);
|
||||
resultMap.put("paginationInfo", paginationInfo);
|
||||
resultMap.put("user", user);
|
||||
|
||||
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
|
||||
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
|
||||
resultVO.setResult(resultMap);
|
||||
return resultVO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.dbnt.kcscbackend.standardCode.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_document_content")
|
||||
public class TnDocumentContent {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "doc_cont_seq")
|
||||
private Integer docContSeq;
|
||||
@Column(name = "doc_info_seq")
|
||||
private Integer docInfoSeq;
|
||||
@Column(name = "cont_order")
|
||||
private Integer contOrder;
|
||||
@Column(name = "onto_link_cd")
|
||||
private String ontoLinkCd;
|
||||
@Column(name = "group_title")
|
||||
private String groupTitle;
|
||||
@Column(name = "cont_type_cd")
|
||||
private String contTypeCd;
|
||||
@Column(name = "cont_level")
|
||||
private Integer contLevel;
|
||||
@Column(name = "parent_cont_seq")
|
||||
private Integer parentContSeq;
|
||||
@Column(name = "cont_label")
|
||||
private String contLabel;
|
||||
@Column(name = "table_content")
|
||||
private String tableContent;
|
||||
@Column(name = "full_content")
|
||||
private String fullContent;
|
||||
@Column(name = "cont_rev_yn")
|
||||
private String contRevYn;
|
||||
@Column(name = "cont_abolish_yn")
|
||||
private String contAbolishYn;
|
||||
@Column(name = "doc_rev_hist_seq")
|
||||
private Integer docRevHistSeq;
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
@Column(name = "error_cd")
|
||||
private String errorCd;
|
||||
@Column(name = "old_seq")
|
||||
private Integer oldSeq;
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
package com.dbnt.kcscbackend.standardCode.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_document_group")
|
||||
public class TnDocumentGroup {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "group_seq")
|
||||
private Integer groupSeq;
|
||||
@Column(name = "group_full_cd")
|
||||
private String groupFullCd;
|
||||
@Column(name = "kcsc_cd")
|
||||
private String kcscCd;
|
||||
@Column(name = "group_cur_cd")
|
||||
private String groupCurCd;
|
||||
@Column(name = "group_nm")
|
||||
private String groupNm;
|
||||
@Column(name = "group_type")
|
||||
private String groupType;
|
||||
@Column(name = "item_cd")
|
||||
private String itemCd;
|
||||
@Column(name = "doc_type")
|
||||
private Integer docType;
|
||||
@Column(name = "doc_level")
|
||||
private Integer docLevel;
|
||||
@Column(name = "doc_order")
|
||||
private Integer docOrder;
|
||||
@Column(name = "parent_group_seq")
|
||||
private Integer parentGroupSeq;
|
||||
@Column(name = "rvsn_remark")
|
||||
private String rvsnRemark;
|
||||
@Column(name = "frst_crt_id")
|
||||
private String frstCrtId;
|
||||
@Column(name = "frst_crt_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime frstCrtDt;
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
@Column(name = "last_chg_dt")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastChgDt;
|
||||
@Column(name = "use_yn")
|
||||
private String useYn;
|
||||
@Column(name = "old_seq")
|
||||
private Integer oldSeq;
|
||||
}
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package com.dbnt.kcscbackend.standardCode.entity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_document_info")
|
||||
public class TnDocumentInfo {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "doc_info_seq")
|
||||
private int docInfoSeq;
|
||||
@Column(name = "group_seq", nullable = false)
|
||||
private int groupSeq;
|
||||
@Column(name = "kcsc_cd")
|
||||
private String kcscCd;
|
||||
@Column(name = "old_kcsc_cd")
|
||||
private String oldKcscCd;
|
||||
@Column(name = "doc_nm", nullable = false)
|
||||
private String docNm;
|
||||
@Column(name = "doc_yr", nullable = false)
|
||||
private String docYr;
|
||||
@Column(name = "doc_cycl", nullable = false)
|
||||
private int docCycl;
|
||||
@Column(name = "doc_er", nullable = false)
|
||||
private String docEr;
|
||||
@Column(name = "estb_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date estbYmd;
|
||||
@Column(name = "rvsn_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date rvsnYmd;
|
||||
@Column(name = "doc_rev_hist_seq")
|
||||
private int docRevHistSeq;
|
||||
@Column(name = "doc_brief", length = 1000)
|
||||
private String docBrief;
|
||||
@Column(name = "doc_rvsn_remark", length = 1000)
|
||||
private String docRvsnRemark;
|
||||
@Column(name = "doc_consider", length = 255)
|
||||
private String docConsider;
|
||||
@Column(name = "doc_advice", length = 255)
|
||||
private String docAdvice;
|
||||
@Column(name = "doc_dept", length = 255)
|
||||
private String docDept;
|
||||
@Column(name = "doc_relation", length = 255)
|
||||
private String docRelation;
|
||||
@Column(name = "doc_publish", length = 255)
|
||||
private String docPublish;
|
||||
@Column(name = "aplcn_bgng_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date aplcnBgngYmd;
|
||||
@Column(name = "aplcn_end_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date aplcnEndYmd;
|
||||
@Column(name = "doc_order", nullable = false)
|
||||
private int docOrder;
|
||||
@Column(name = "last_yn", nullable = false)
|
||||
private char lastYn;
|
||||
@Column(name = "doc_file_grp_id")
|
||||
private String docFileGrpId;
|
||||
@Column(name = "rvsn_file_grp_id")
|
||||
private String rvsnFileGrpId;
|
||||
@Column(name = "frst_crt_id", nullable = false)
|
||||
private String frstCrtId;
|
||||
@Column(name = "frst_crt_dt", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date frstCrtDt;
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
@Column(name = "last_chg_dt")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date lastChgDt;
|
||||
@Column(name = "use_yn", nullable = false)
|
||||
private char useYn;
|
||||
@Column(name = "old_seq")
|
||||
private Integer oldSeq;
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
package com.dbnt.kcscbackend.standardCode.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.DynamicInsert;
|
||||
import org.hibernate.annotations.DynamicUpdate;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@NoArgsConstructor
|
||||
@DynamicInsert
|
||||
@DynamicUpdate
|
||||
@Table(name = "tn_document_info")
|
||||
public class TnDocumentInfoVO extends TnDocumentInfo {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "doc_info_seq")
|
||||
private int docInfoSeq;
|
||||
@Column(name = "group_seq", nullable = false)
|
||||
private int groupSeq;
|
||||
@Column(name = "kcsc_cd")
|
||||
private String kcscCd;
|
||||
@Column(name = "old_kcsc_cd")
|
||||
private String oldKcscCd;
|
||||
@Column(name = "doc_nm", nullable = false)
|
||||
private String docNm;
|
||||
@Column(name = "doc_yr", nullable = false)
|
||||
private String docYr;
|
||||
@Column(name = "doc_cycl", nullable = false)
|
||||
private int docCycl;
|
||||
@Column(name = "doc_er", nullable = false)
|
||||
private String docEr;
|
||||
@Column(name = "estb_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date estbYmd;
|
||||
@Column(name = "rvsn_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date rvsnYmd;
|
||||
@Column(name = "doc_rev_hist_seq")
|
||||
private int docRevHistSeq;
|
||||
@Column(name = "doc_brief", length = 1000)
|
||||
private String docBrief;
|
||||
@Column(name = "doc_rvsn_remark", length = 1000)
|
||||
private String docRvsnRemark;
|
||||
@Column(name = "doc_consider", length = 255)
|
||||
private String docConsider;
|
||||
@Column(name = "doc_advice", length = 255)
|
||||
private String docAdvice;
|
||||
@Column(name = "doc_dept", length = 255)
|
||||
private String docDept;
|
||||
@Column(name = "doc_relation", length = 255)
|
||||
private String docRelation;
|
||||
@Column(name = "doc_publish", length = 255)
|
||||
private String docPublish;
|
||||
@Column(name = "aplcn_bgng_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date aplcnBgngYmd;
|
||||
@Column(name = "aplcn_end_ymd")
|
||||
@Temporal(TemporalType.DATE)
|
||||
private Date aplcnEndYmd;
|
||||
@Column(name = "doc_order", nullable = false)
|
||||
private int docOrder;
|
||||
@Column(name = "last_yn", nullable = false)
|
||||
private char lastYn;
|
||||
@Column(name = "doc_file_grp_id")
|
||||
private String docFileGrpId;
|
||||
@Column(name = "rvsn_file_grp_id")
|
||||
private String rvsnFileGrpId;
|
||||
@Column(name = "frst_crt_id", nullable = false)
|
||||
private String frstCrtId;
|
||||
@Column(name = "frst_crt_dt", nullable = false)
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date frstCrtDt;
|
||||
@Column(name = "last_chg_id")
|
||||
private String lastChgId;
|
||||
@Column(name = "last_chg_dt")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date lastChgDt;
|
||||
@Column(name = "use_yn", nullable = false)
|
||||
private char useYn;
|
||||
@Column(name = "old_seq")
|
||||
private Integer oldSeq;
|
||||
|
||||
@Schema(description = "현재페이지")
|
||||
private int pageIndex = 1;
|
||||
@Schema(description = "페이지갯수")
|
||||
private int pageUnit = 10;
|
||||
@Schema(description = "페이지사이즈")
|
||||
private int pageSize = 10;
|
||||
@Schema(description = "첫페이지 인덱스")
|
||||
private int firstIndex = 1;
|
||||
@Schema(description = "마지막페이지 인덱스")
|
||||
private int lastIndex = 1;
|
||||
@Schema(description = "페이지당 레코드 개수")
|
||||
private int recordCountPerPage = 10;
|
||||
@Schema(description = "레코드 번호")
|
||||
private int rowNo = 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.dbnt.kcscbackend.standardCode.mapper;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfoVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StandardCodeMapper {
|
||||
|
||||
List<TnDocumentInfoVO> selectStandardCodeList(TnDocumentInfo tnDocumentInfo);
|
||||
|
||||
Integer selectStandardCodeListCnt(TnDocumentInfo tnDocumentInfo);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.dbnt.kcscbackend.standardCode.repository;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentContent;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeContentInterface;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TnDocumentContentRepository extends JpaRepository<TnDocumentContent, Integer> {
|
||||
|
||||
@Query(value = "select * from get_recent_full_context_by_content(:docCode, :docPart)", nativeQuery = true)
|
||||
public List<StandardCodeContentInterface> getRecentFullContextByContent(String docCode, String docPart);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.dbnt.kcscbackend.standardCode.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentGroup;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeTreeInterface;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TnDocumentGroupRepository extends JpaRepository<TnDocumentGroup, Integer> {
|
||||
|
||||
@Query(value = "select * from sp_get_tn_document_code_by_tree()", nativeQuery = true)
|
||||
public List<StandardCodeTreeInterface> spGetTnDocumentCodeByTree();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dbnt.kcscbackend.standardCode.repository;
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface TnDocumentInfoRepository extends JpaRepository<TnDocumentInfo, Integer> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
public interface StandardCodeContentInterface {
|
||||
String getOnto_link_cd();
|
||||
String getGroup_title();
|
||||
String getCont_type_cd();
|
||||
Integer getCont_level();
|
||||
Integer getParent_cont_seq();
|
||||
String getCont_label();
|
||||
String getError_cd();
|
||||
String getTable_content();
|
||||
String getFull_content();
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfoVO;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 게시물 관리를 위한 서비스 인터페이스 클래스
|
||||
* @author 공통 서비스 개발팀 이삼섭
|
||||
* @since 2009.03.19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.19 이삼섭 최초 생성
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
public interface StandardCodeListService {
|
||||
|
||||
/**
|
||||
* 조건에 맞는 게시물 목록을 조회 한다.
|
||||
* @return
|
||||
*
|
||||
* @param
|
||||
* @param
|
||||
* @exception Exception Exception
|
||||
*/
|
||||
public Map<String, Object> selectStandardCodeList(TnDocumentInfoVO tnDocumentInfoVO)
|
||||
throws Exception;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentContentRepository;
|
||||
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentGroupRepository;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
@RequiredArgsConstructor
|
||||
public class StandardCodeService {
|
||||
private final TnDocumentGroupRepository tnDocumentGroupRepository;
|
||||
private final TnDocumentContentRepository tnDocumentContentRepository;
|
||||
|
||||
public List<StandardCodeTreeInterface> selectStandardCodeTree(){
|
||||
return tnDocumentGroupRepository.spGetTnDocumentCodeByTree();
|
||||
}
|
||||
|
||||
public List<StandardCodeContentInterface> selectStandardCodeDocument(StandardCodeVO param) {
|
||||
return tnDocumentContentRepository.getRecentFullContextByContent(param.getDocCode(), param.getDocPart());
|
||||
}
|
||||
|
||||
/*public List<TnDocumentInfo> selectStandardCodeList(TnDocumentInfo tnDocumentInfo) {
|
||||
return standardCodeMapper.selectStandardCodeList(tnDocumentInfo);
|
||||
}
|
||||
|
||||
public Integer selectStandardCodeListCnt(TnDocumentInfo tnDocumentInfo) {
|
||||
return standardCodeMapper.selectStandardCodeListCnt(tnDocumentInfo);
|
||||
}*/
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
public interface StandardCodeTreeInterface {
|
||||
Integer getSeq();
|
||||
Integer getDoc_level();
|
||||
Integer getParent_seq();
|
||||
String getGroup_yn();
|
||||
String getDoc_code();
|
||||
String getDoc_code_ver();
|
||||
String getDoc_code_name();
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StandardCodeVO {
|
||||
private String docCode;
|
||||
private String docPart;
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package com.dbnt.kcscbackend.standardCode.service.impl;
|
||||
|
||||
|
||||
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfoVO;
|
||||
import com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeListService;
|
||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 게시물 관리를 위한 서비스 구현 클래스
|
||||
* @author 공통 서비스 개발팀 한성곤
|
||||
* @since 2009.03.19
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* << 개정이력(Modification Information) >>
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2009.03.19 이삼섭 최초 생성
|
||||
* 2011.08.31 JJY 경량환경 템플릿 커스터마이징버전 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Service("StandardCodeListService")
|
||||
public class StandardCodeListServiceImpl extends EgovAbstractServiceImpl implements StandardCodeListService {
|
||||
|
||||
private StandardCodeMapper standardCodeMapper;
|
||||
|
||||
/**
|
||||
* 조건에 맞는 게시물 목록을 조회 한다.
|
||||
*
|
||||
* @see
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> selectStandardCodeList(TnDocumentInfoVO tnDocumentInfoVO) throws Exception {
|
||||
List<TnDocumentInfoVO> list = standardCodeMapper.selectStandardCodeList(tnDocumentInfoVO);
|
||||
List<TnDocumentInfoVO> result = new ArrayList<TnDocumentInfoVO>();
|
||||
|
||||
result = list;
|
||||
|
||||
int cnt = standardCodeMapper.selectStandardCodeListCnt(tnDocumentInfoVO);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("resultList", result);
|
||||
map.put("resultCnt", Integer.toString(cnt));
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
spring.devtools.livereload.enabled=true
|
||||
|
||||
#Datasource Configuration
|
||||
spring.sql.init.encoding=utf-8
|
||||
#maximum-pool-size: CPU core count
|
||||
|
|
@ -19,5 +18,10 @@ spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming.
|
|||
# MyBatis
|
||||
mybatis.mapper-locations: mybatisMapper/*.xml
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
mybatis.type-aliases-package=com.dbnt.kcscbackend.**.model
|
||||
logging.level.com.atoz_develop.mybatissample.repository=TRACE
|
||||
mybatis.type-aliases-package=com.dbnt.kcscbackend.**.entity
|
||||
logging.level.com.atoz_develop.mybatissample.repository=TRACE
|
||||
|
||||
# File Config
|
||||
Globals.posblAtchFileSize=5242880
|
||||
Globals.fileStorePath=D:\\kcsc
|
||||
Globals.addedOptions=false
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
|
||||
|
||||
# Page Config
|
||||
Globals.pageUnit=10
|
||||
Globals.pageSize=10
|
||||
|
||||
# Access-Control-Allow-Origin
|
||||
Globals.Allow.Origin = http://localhost:3000
|
||||
|
||||
#JWT secret key
|
||||
Globals.jwt.secret = egovframe
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
|
||||
log4jdbc.dump.sql.maxlinelength=0
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dbnt.kcscbackend.standardCode.mapper.StandardCodeMapper">
|
||||
|
||||
<select id="selectStandardCodeList" parameterType="TnDocumentInfoVO" resultMap="TnDocumentInfoVO">
|
||||
SELECT
|
||||
doc_info_seq,
|
||||
use_yn,
|
||||
rvsn_ymd,
|
||||
rvsn_file_grp_id,
|
||||
old_seq,
|
||||
old_kcsc_cd,
|
||||
last_yn,
|
||||
last_chg_id,
|
||||
last_chg_dt,
|
||||
kcsc_cd,
|
||||
group_seq,
|
||||
frst_crt_id,
|
||||
frst_crt_dt,
|
||||
estb_ymd,
|
||||
doc_yr,
|
||||
doc_rvsn_remark,
|
||||
doc_rev_hist_seq,
|
||||
doc_relation,
|
||||
doc_publish,
|
||||
doc_order,
|
||||
doc_nm,
|
||||
doc_file_grp_id,
|
||||
doc_er,
|
||||
doc_dept,
|
||||
doc_cycl,
|
||||
doc_consider,
|
||||
doc_brief,
|
||||
doc_advice,
|
||||
aplcn_end_ymd,
|
||||
aplcn_bgng_ymd
|
||||
FROM
|
||||
tn_document_info
|
||||
WHERE 1 = 1
|
||||
ORDER BY doc_info_seq desc
|
||||
LIMIT #{recordCountPerPage} OFFSET #{firstIndex}
|
||||
</select>
|
||||
|
||||
<select id="selectStandardCodeListCnt" parameterType="TnDocumentInfoVO" resultType="int">
|
||||
SELECT count(*)
|
||||
FROM
|
||||
tn_document_info
|
||||
WHERE 1 = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue