config: config set

dev
minuk926 2 years ago
parent 5ed807b717
commit faa273f382

@ -28,7 +28,7 @@ plugins {
group = 'com.xit' group = 'com.xit'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
description = 'xit-opst-be' description = 'xit-opst-be'
sourceCompatibility = '11' sourceCompatibility = '1.8'
// WAS : bootWar.enabled = false // WAS : bootWar.enabled = false
bootWar.enabled = false bootWar.enabled = false
@ -70,8 +70,8 @@ dependencies {
//implementation 'org.springframework.boot:spring-boot-starter-hateoas' //implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'org.springframework.boot:spring-boot-configuration-processor' implementation 'org.springframework.boot:spring-boot-configuration-processor'
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa' //implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-jdbc' //implementation 'org.springframework.boot:spring-boot-starter-jdbc'
// config // config
implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3' implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3'

@ -9,8 +9,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import javax.persistence.EnumType; //import javax.persistence.EnumType;
import javax.persistence.Enumerated; //import javax.persistence.Enumerated;
import javax.validation.constraints.Email; import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
@ -59,13 +59,13 @@ public class CmmUserDto implements Serializable { //extends RepresentationModel<
private String email; private String email;
@Schema(required = true, title = "권한", example = "USER", description = "권한 - ROLE_USER, ROLE_ADMIN") @Schema(required = true, title = "권한", example = "USER", description = "권한 - ROLE_USER, ROLE_ADMIN")
@Enumerated(EnumType.STRING) //@Enumerated(EnumType.STRING)
@EnumNamePattern(regexp = "ADMIN|USER|GUEST", message = "{auth.user.pattern.RoleType}") @EnumNamePattern(regexp = "ADMIN|USER|GUEST", message = "{auth.user.pattern.RoleType}")
private RoleType roleType; private RoleType roleType;
////////////////////////// Socail 사용시 //////////////////////////////////////////////////////////////// ////////////////////////// Socail 사용시 ////////////////////////////////////////////////////////////////
@Schema(required = true, title = "ProviderType Type", example = "LOCAL", description = "SNS TYPE") @Schema(required = true, title = "ProviderType Type", example = "LOCAL", description = "SNS TYPE")
@Enumerated(EnumType.STRING) //@Enumerated(EnumType.STRING)
@Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}") @Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}")
private ProviderType providerType; private ProviderType providerType;

@ -6,27 +6,13 @@ import com.xit.core.oauth2.oauth.entity.RoleType;
import com.xit.core.support.jpa.AuditEntity; import com.xit.core.support.jpa.AuditEntity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.hibernate.Hibernate;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
import java.io.Serializable; import java.io.Serializable;
import java.util.Objects; import java.util.Objects;
@Schema(name = "CmmUserMst", description = "사용자 마스터") //, parent = AuditEntity.class) @Schema(name = "CmmUserMst", description = "사용자 마스터") //, parent = AuditEntity.class)
@Table(
name = "tb_cmm_user_mst",
indexes = {
@Index(unique = true, name = "idx_tb_cmm_user_mst_01", columnList ="user_id")
//@Index(name = "idx_tb_cmm_user_mst_02", columnList ="user_id,user_name,user_email")
}
)
@Entity
@DynamicInsert
@DynamicUpdate
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter @Getter
@ -37,72 +23,47 @@ public class CmmUser extends AuditEntity implements Serializable { //extends Rep
@Setter @Setter
@JsonProperty(access = JsonProperty.Access.READ_ONLY) @JsonProperty(access = JsonProperty.Access.READ_ONLY)
@Schema(required = true, title = "사용자ID(PK)", example = "W000000001") @Schema(required = true, title = "사용자ID(PK)", example = "W000000001")
@Id
@Column(name = "cmm_user_id", length = 64)
private String cmmUserId; private String cmmUserId;
@Setter @Setter
@Schema(required = true, title = "사용자ID(실제ID)", example = "minuk926", description = "논리적인 실제 PK(unique)") @Schema(required = true, title = "사용자ID(실제ID)", example = "minuk926", description = "논리적인 실제 PK(unique)")
@Column(name = "user_id", length = 64, nullable = false, unique = true)
//@NotNull
//@Size(max = 64)
private String userId; private String userId;
//TODO : ??? //TODO : ???
@Setter @Setter
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
@Schema(required = true, title = "사용자 비밀번호", example = "minuk926") @Schema(required = true, title = "사용자 비밀번호", example = "minuk926")
@Column(name="password", length = 128, nullable = false)
//@NotNull //@NotNull
//@Size(max = 128) //@Size(max = 128)
private String password; private String password;
@Setter @Setter
@Schema(required = true, title = "사용자 이름", example = "홍길동") @Schema(required = true, title = "사용자 이름", example = "홍길동")
@Column(name="user_name", length = 100, nullable = false)
//@NotNull
//@Size(max = 100)
private String userName; private String userName;
@Setter @Setter
@Schema(title = "사용자 이메일", example = "a@b.com") @Schema(title = "사용자 이메일", example = "a@b.com")
@Column(name="email", length = 100, nullable = false)
//@Size(max = 100)
private String email; private String email;
@Setter @Setter
@Schema(title = "전화번호", example = "01012341234") @Schema(title = "전화번호", example = "01012341234")
@Column(name="user_mbl", length = 100)
//@Size(max = 128)
private String userMbl; private String userMbl;
@Setter @Setter
@Column(name = "role_type", length = 20, nullable = false)
@Enumerated(EnumType.STRING)
//@NotNull
private RoleType roleType; private RoleType roleType;
/////////////////////////// Social login 관련 //////////////////////////////////// /////////////////////////// Social login 관련 ////////////////////////////////////
@Setter @Setter
@Column(name = "provider_type", length = 50, nullable = false)
@Enumerated(EnumType.STRING)
//@NotNull
private ProviderType providerType; private ProviderType providerType;
@Setter @Setter
@Schema(title = "프로필이미지URL", example = " ", description = "SNS로 로그인시 필수") @Schema(title = "프로필이미지URL", example = " ", description = "SNS로 로그인시 필수")
@Column(name = "profile_image_url", length = 256)
//@NotNull
//@Size(max = 256)
private String profileImageUrl; private String profileImageUrl;
@Builder.Default @Builder.Default
@Setter @Setter
@Column(name = "email_verified_yn", length = 1, nullable = false)
//@NotNull
//@Size(min = 1, max = 1)
private String emailVerifiedYn = "N"; private String emailVerifiedYn = "N";
public CmmUser( public CmmUser(
@ -170,14 +131,7 @@ public class CmmUser extends AuditEntity implements Serializable { //extends Rep
// //
// } // }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
CmmUser cmmUser = (CmmUser) o;
return Objects.equals(cmmUserId, cmmUser.cmmUserId);
}
@Override @Override
public int hashCode() { public int hashCode() {

@ -3,7 +3,6 @@ package com.xit.biz.cmm.entity.ids;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import javax.persistence.Column;
import java.io.Serializable; import java.io.Serializable;
@Schema(name = "CmmCodeSIds", description = "소분류코드 PK(ClassIds) && 콤보코드 조회시 파라메터(searchKeyDto)로 사용") @Schema(name = "CmmCodeSIds", description = "소분류코드 PK(ClassIds) && 콤보코드 조회시 파라메터(searchKeyDto)로 사용")
@ -14,18 +13,14 @@ import java.io.Serializable;
public class CmmCodeSIds implements Serializable { public class CmmCodeSIds implements Serializable {
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID") @Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID")
@Column(name = "code_grp_id", nullable = false, length = 20)
private String codeGrpId; private String codeGrpId;
@Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류 코드값") @Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류 코드값")
@Column(name = "code_lcd", nullable = false, length = 10)
private String codeLcd; private String codeLcd;
@Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값") @Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값")
@Column(name = "code_mcd", nullable = false, length = 10)
private String codeMcd; private String codeMcd;
@Schema(required = true, title = "공통코드 코드", example = "001", description = "공통코드의 코드값") @Schema(required = true, title = "공통코드 코드", example = "001", description = "공통코드의 코드값")
@Column(name = "code_cd", nullable = false, length = 10)
private String codeCd; private String codeCd;
} }

@ -73,7 +73,7 @@ public class AuthMinService implements IAuthMinService {
* @return TokenDto * @return TokenDto
*/ */
@Override @Override
@Transactional //@Transactional
public TokenDto login(final LoginMinRequestDto loginRequestDto, public TokenDto login(final LoginMinRequestDto loginRequestDto,
HttpServletRequest request, HttpServletRequest request,
HttpServletResponse response, HttpServletResponse response,
@ -197,7 +197,7 @@ public class AuthMinService implements IAuthMinService {
* @return TokenDto * @return TokenDto
*/ */
@Override @Override
@Transactional //@Transactional
public TokenDto reissue(final TokenRequestDto tokenRequestDto, HttpServletRequest request, HttpServletResponse response) { public TokenDto reissue(final TokenRequestDto tokenRequestDto, HttpServletRequest request, HttpServletResponse response) {
TokenDto tokenDto = new TokenDto(); TokenDto tokenDto = new TokenDto();
String sAccessToken = null; String sAccessToken = null;
@ -291,28 +291,28 @@ public class AuthMinService implements IAuthMinService {
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public boolean validationToken(final String accessToken, final boolean isExceptionThrow) { public boolean validationToken(final String accessToken, final boolean isExceptionThrow) {
return jwtTokenProvider.validateTokenExcludeExpired(accessToken, false, isExceptionThrow); return jwtTokenProvider.validateTokenExcludeExpired(accessToken, false, isExceptionThrow);
} }
// TODO :: 적용 필요 // TODO :: 적용 필요
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Map<String, Object> findAccessTokenInfo(String accessToken) { public Map<String, Object> findAccessTokenInfo(String accessToken) {
return jwtTokenProvider.getAccessTokenInfo(accessToken); //authTokenProvider.getAccessTokenInfo(accessToken); return jwtTokenProvider.getAccessTokenInfo(accessToken); //authTokenProvider.getAccessTokenInfo(accessToken);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Optional<CmmUser> findMyUserWithoutAuthorities() { public Optional<CmmUser> findMyUserWithoutAuthorities() {
//cmmUserRepos //cmmUserRepos
return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Optional<CmmUser> findUserWithAuthorities(final String userId) { public Optional<CmmUser> findUserWithAuthorities(final String userId) {
return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(userId); return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(userId);
} }

@ -4,7 +4,6 @@ import com.xit.core.oauth2.utils.HeaderUtil;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import javax.persistence.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;

@ -9,8 +9,6 @@ import lombok.*;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -29,7 +27,7 @@ public class LoginMinRequestDto {
* Enum type Validation -> controller * Enum type Validation -> controller
*/ */
@Schema(required = true, title = "Provider Type", example = "LOCAL", description = "Provider TYPE") @Schema(required = true, title = "Provider Type", example = "LOCAL", description = "Provider TYPE")
@Enumerated(EnumType.STRING) //@Enumerated(EnumType.STRING)
@Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}") @Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}")
private ProviderType providerType; private ProviderType providerType;

@ -9,8 +9,6 @@ import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.persistence.Column;
import javax.persistence.Transient;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -65,7 +63,6 @@ public class MinInfoBoard680Dto implements Serializable {
@Schema(required = false, title = "기타", example = " ", description = "Input Description...") @Schema(required = false, title = "기타", example = " ", description = "Input Description...")
private String inEtc; private String inEtc;
@Transient
@Schema(required = false, title = "파일", example = " ", description = "파일") @Schema(required = false, title = "파일", example = " ", description = "파일")
private MultipartFile[] files; private MultipartFile[] files;

@ -3,7 +3,6 @@ package com.xit.biz.ctgy.dto;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import javax.persistence.*;
import java.time.LocalDate; import java.time.LocalDate;
@Schema(name = "MinSimsaUser680ScDto", description = "거주자/장애인 심사사용자매핑") @Schema(name = "MinSimsaUser680ScDto", description = "거주자/장애인 심사사용자매핑")

@ -2,11 +2,8 @@ package com.xit.biz.ctgy.entity;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*; import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.domain.Persistable; import org.springframework.data.domain.Persistable;
import javax.persistence.*;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -17,60 +14,44 @@ import java.util.Objects;
* Persistable : persitance getId isNew Override * Persistable : persitance getId isNew Override
*/ */
@Schema(name = "MinUserinfo", description = "null") @Schema(name = "MinUserinfo", description = "null")
@Table(name = "min_userinfo", schema = "", catalog = "")
@Entity
@DynamicInsert
@DynamicUpdate
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED) @NoArgsConstructor(access = AccessLevel.PROTECTED)
@Getter @Getter
@Builder @Builder
public class MinUserinfo implements Persistable<String> { public class MinUserinfo implements Persistable<String> {
@Id
@Schema(required = true, title = "민원심사사용자코드", example = " ", description = "Input Description...") @Schema(required = true, title = "민원심사사용자코드", example = " ", description = "Input Description...")
@Column(name = "userid", nullable = false, length = 20)
private String userid; private String userid;
@Schema(required = true, title = "사용자암호", example = " ", description = "Input Description...") @Schema(required = true, title = "사용자암호", example = " ", description = "Input Description...")
@Column(name = "passwd", nullable = false, length = 48)
private String passwd; private String passwd;
@Schema(required = true, title = "사용자성명", example = " ", description = "Input Description...") @Schema(required = true, title = "사용자성명", example = " ", description = "Input Description...")
@Column(name = "name", nullable = false, length = 100)
private String name; private String name;
@Schema(required = false, title = "사용자주민번호", example = " ", description = "Input Description...") @Schema(required = false, title = "사용자주민번호", example = " ", description = "Input Description...")
@Column(name = "regnum", nullable = true, length = 20)
private String regnum; private String regnum;
@Schema(required = false, title = "전화번호", example = " ", description = "Input Description...") @Schema(required = false, title = "전화번호", example = " ", description = "Input Description...")
@Column(name = "mphone", nullable = true, length = 20)
private String mphone; private String mphone;
@Schema(required = false, title = "이메일", example = " ", description = "Input Description...") @Schema(required = false, title = "이메일", example = " ", description = "Input Description...")
@Column(name = "email", nullable = true, length = 20)
private String email; private String email;
@Schema(required = true, title = "사용구분", example = " ", description = "Input Description...") @Schema(required = true, title = "사용구분", example = " ", description = "Input Description...")
@Column(name = "accesstype", nullable = true, length = 3)
private String accesstype; private String accesstype;
@Schema(required = true, title = "단속조", example = " ", description = "Input Description...") @Schema(required = true, title = "단속조", example = " ", description = "Input Description...")
@Column(name = "team", nullable = true, length = 3)
private String team; private String team;
@Schema(required = false, title = "등록일시", example = " ", description = "Input Description...") @Schema(required = false, title = "등록일시", example = " ", description = "Input Description...")
@Column(name = "regdate", nullable = true)
private LocalDate regdate; private LocalDate regdate;
@Schema(required = false, title = "사용여부", example = " ", description = "Input Description...") @Schema(required = false, title = "사용여부", example = " ", description = "Input Description...")
@Column(name = "isenable", nullable = true, length = 1)
@Setter @Setter
private String isenable; private String isenable;
@Schema(required = false, title = "구청코드", example = " ", description = "Input Description...") @Schema(required = false, title = "구청코드", example = " ", description = "Input Description...")
@Column(name = "gu", nullable = true, length = 3)
private String gu; private String gu;
@ -85,7 +66,6 @@ public class MinUserinfo implements Persistable<String> {
} }
@PrePersist
public void onPrePersist(){ public void onPrePersist(){
LocalDateTime localDateTime = LocalDateTime.now(); LocalDateTime localDateTime = LocalDateTime.now();
this.regdate = LocalDate.parse(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); this.regdate = LocalDate.parse(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
@ -93,7 +73,6 @@ public class MinUserinfo implements Persistable<String> {
this.gu = "680"; this.gu = "680";
} }
@PreUpdate
public void onPreUpdate(){ public void onPreUpdate(){
// LocalDateTime localDateTime = LocalDateTime.now(); // LocalDateTime localDateTime = LocalDateTime.now();
// this.inNalja = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); // this.inNalja = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));

@ -24,6 +24,7 @@ import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.URLEncoder; import java.net.URLEncoder;
@ -127,7 +128,11 @@ public class CmmFileController {
response.setContentType(contentType); response.setContentType(contentType);
response.setHeader(HttpHeaders.CONTENT_TYPE, contentType); response.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileName, StandardCharsets.UTF_8) + "\";"); try {
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(fileName, "utf-8") + "\";");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
//response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary"); //response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary");
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize)); response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(fileSize));
try { try {

@ -24,6 +24,7 @@ import javax.annotation.Nonnull;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
@ -105,7 +106,11 @@ public class CtgyFileMgtController {
response.setContentType(contentType); response.setContentType(contentType);
response.setHeader(HttpHeaders.CONTENT_TYPE, contentType); response.setHeader(HttpHeaders.CONTENT_TYPE, contentType);
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(dto.getInFilename(), StandardCharsets.UTF_8) + "\";"); try {
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + URLEncoder.encode(dto.getInFilename(), "utf-8") + "\";");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
//response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary"); //response.setHeader(HttpHeaders.CONTENT_ENCODING, "binary");
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(dto.getInFilesize())); response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(dto.getInFilesize()));
try { try {
@ -149,7 +154,7 @@ public class CtgyFileMgtController {
headers.add(HttpHeaders.CONTENT_TYPE, contentType); headers.add(HttpHeaders.CONTENT_TYPE, contentType);
headers.setContentDisposition(ContentDisposition.builder("attachment") headers.setContentDisposition(ContentDisposition.builder("attachment")
.filename(entity.getInFilename(), StandardCharsets.UTF_8) .filename(entity.getInFilename(), StandardCharsets.UTF_8)
//.filename(URLEncoder.encode(entity.getInFilename(), StandardCharsets.UTF_8)) //.filename(URLEncoder.encode(entity.getInFilename(), "utf-8"))
.build()); .build());
headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize())); headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize()));

@ -52,14 +52,14 @@ public class MinUserController {
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
@GetMapping("/info") @GetMapping("/info")
@Secured(policy = SecurityPolicy.TOKEN) @Secured(policy = SecurityPolicy.TOKEN)
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public ResponseEntity<? extends IRestResponse> getMinUser() { public ResponseEntity<? extends IRestResponse> getMinUser() {
return RestResponse.of(service.findMinUser()); return RestResponse.of(service.findMinUser());
} }
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
@GetMapping("/{userid}") @GetMapping("/{userid}")
//@Transactional(readOnly = true) ////@Transactional(readOnly = true)
public ResponseEntity<? extends IRestResponse> getMinUser(@PathVariable final String userid) { public ResponseEntity<? extends IRestResponse> getMinUser(@PathVariable final String userid) {
return RestResponse.of(service.findMinUserByUserid(userid)); return RestResponse.of(service.findMinUserByUserid(userid));
} }

@ -58,7 +58,7 @@ public class OAuth2MinController {
*/ */
@Operation(summary = "login" , description = "login") @Operation(summary = "login" , description = "login")
@PostMapping("/login") @PostMapping("/login")
@Transactional //@Transactional
public ResponseEntity<? extends IRestResponse> login( public ResponseEntity<? extends IRestResponse> login(
@Valid @Valid
@RequestBody @RequestBody

@ -35,7 +35,7 @@ public class BoardService implements IBoardService {
} }
@Override @Override
@Transactional //@Transactional
public void saveBoard(BoardDto dto) { public void saveBoard(BoardDto dto) {
// update 인 경우 // update 인 경우
@ -61,7 +61,7 @@ public class BoardService implements IBoardService {
} }
@Override @Override
@Transactional //@Transactional
public void removeBoard(final Long ciCode) { public void removeBoard(final Long ciCode) {
BoardDto savedDto = boardDao.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND)); BoardDto savedDto = boardDao.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND));

@ -85,7 +85,7 @@ public class CmmCodeService implements ICmmCodeService {
// } // }
// //
// @Override // @Override
// @Transactional // //@Transactional
// public CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp) { // public CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp) {
// AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeGrpId()), "코드 그룹을 입력해 주세요."); // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
// AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeNm()), "코드 그룹명 입력해 주세요."); // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeNm()), "코드 그룹명 입력해 주세요.");
@ -93,7 +93,7 @@ public class CmmCodeService implements ICmmCodeService {
// return cmmCodeGrpRepository.save(cmmCodeGrp); // return cmmCodeGrpRepository.save(cmmCodeGrp);
// } // }
// //
// @Transactional // //@Transactional
// @Override // @Override
// public Object saveCmmCode(CmmCodeDto cmmCodeDto) { // public Object saveCmmCode(CmmCodeDto cmmCodeDto) {
// AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "코드그룹을 입력해 주세요."); // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "코드그룹을 입력해 주세요.");

@ -36,7 +36,7 @@ public class CmmFileService implements ICmmFileService {
* @return String makePath * @return String makePath
*/ */
@Override @Override
@Transactional //@Transactional
public String uploadFiles(MultipartFile[] files, String rootPath, String uploadPath) { public String uploadFiles(MultipartFile[] files, String rootPath, String uploadPath) {
String makePath = ""; String makePath = "";

@ -59,7 +59,7 @@ public class CtgyFileService implements ICtgyFileService {
* @return CmmFileMst * @return CmmFileMst
*/ */
@Override @Override
@Transactional //@Transactional
public List<MinInfoBoard680Dto> saveFiles(@Nonnull MinInfoBoard680Dto dto) { public List<MinInfoBoard680Dto> saveFiles(@Nonnull MinInfoBoard680Dto dto) {
List<MinInfoBoard680Dto> entityList = new ArrayList<>(); List<MinInfoBoard680Dto> entityList = new ArrayList<>();
MultipartFile[] files = dto.getFiles(); MultipartFile[] files = dto.getFiles();
@ -133,7 +133,7 @@ public class CtgyFileService implements ICtgyFileService {
} }
@Override @Override
@Transactional //@Transactional
public void removePublicBoardFile(Long inCode) { public void removePublicBoardFile(Long inCode) {
MinInfoBoard680Dto savedEntity = publicBoardDao.findByInCode(inCode); MinInfoBoard680Dto savedEntity = publicBoardDao.findByInCode(inCode);

@ -22,26 +22,26 @@ public class MinUserService implements IMinUserService {
private final PasswordEncoder passwordEncoder; private final PasswordEncoder passwordEncoder;
private final UserDao userDao; private final UserDao userDao;
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<MinUserinfoDto> findMinUsers(final MinUserinfoDto dto, Pageable pageable) { public Page<MinUserinfoDto> findMinUsers(final MinUserinfoDto dto, Pageable pageable) {
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()); pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize());
return userDao.findMinUserList(dto, pageable); return userDao.findMinUserList(dto, pageable);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public MinUserinfoDto findMinUser() { public MinUserinfoDto findMinUser() {
return userDao.findByUserid(HeaderUtil.getUserId()).orElse(null); return userDao.findByUserid(HeaderUtil.getUserId()).orElse(null);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public MinUserinfoDto findMinUserByUserid(final String userid) { public MinUserinfoDto findMinUserByUserid(final String userid) {
return userDao.findByUserid(userid).orElse(null); return userDao.findByUserid(userid).orElse(null);
} }
@Override @Override
@Transactional //@Transactional
public void saveMinUser(MinUserinfoDto dto) { public void saveMinUser(MinUserinfoDto dto) {
Optional<MinUserinfoDto> opUser = userDao.findByUserid(dto.getUserid()); Optional<MinUserinfoDto> opUser = userDao.findByUserid(dto.getUserid());
dto.setPasswd(passwordEncoder.encode(dto.getPasswd())); dto.setPasswd(passwordEncoder.encode(dto.getPasswd()));
@ -57,7 +57,7 @@ public class MinUserService implements IMinUserService {
} }
@Override @Override
@Transactional //@Transactional
public void removeMinUser(MinUserinfoDto dto) { public void removeMinUser(MinUserinfoDto dto) {
dto.setIsenable("0"); dto.setIsenable("0");
userDao.removeMinUserinfo(dto); userDao.removeMinUserinfo(dto);

@ -32,7 +32,7 @@ public class ParkingService implements IParkingService {
private final UserDao userDao; private final UserDao userDao;
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable) { public Page<JudgeListDto> findParkings(final JudgeListDto dto, Pageable pageable) {
return parkingDao.findParkings(dto, pageable); return parkingDao.findParkings(dto, pageable);
} }
@ -87,13 +87,13 @@ public class ParkingService implements IParkingService {
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<ParkingTargetDto> findParkingJudgeTargets(ParkingTargetDto dto) { public List<ParkingTargetDto> findParkingJudgeTargets(ParkingTargetDto dto) {
return parkingDao.findParkingJudgeTargets(dto); return parkingDao.findParkingJudgeTargets(dto);
} }
@Override @Override
@Transactional //@Transactional
public void saveParkingJudgeTargets(ParkingTargetDto dto) { public void saveParkingJudgeTargets(ParkingTargetDto dto) {
boolean isFirst = true; boolean isFirst = true;
@ -152,7 +152,7 @@ public class ParkingService implements IParkingService {
* @param dto ParkingTargetDto * @param dto ParkingTargetDto
*/ */
@Override @Override
@Transactional //@Transactional
public void removeParkingJudge(final ParkingTargetDto dto) { public void removeParkingJudge(final ParkingTargetDto dto) {
List<Long> msMaincodes = parkingDao.findAllMsMaincode(dto); List<Long> msMaincodes = parkingDao.findAllMsMaincode(dto);
@ -169,13 +169,13 @@ public class ParkingService implements IParkingService {
// 심사자 // 심사자
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<JudgeListDto> findByUserJudges() { public List<JudgeListDto> findByUserJudges() {
return parkingDao.findByUserJudges(); return parkingDao.findByUserJudges();
} }
@Override @Override
@Transactional //@Transactional
public void saveJudgeResult(JudgeListDto dto){ public void saveJudgeResult(JudgeListDto dto){
parkingDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), parkingDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(),
dto.getMsuResult(), dto.getMsuResult(),

@ -15,19 +15,19 @@ public class PublicBoardService implements IPublicBoardService {
private final PublicBoardDao publicBoardDao; private final PublicBoardDao publicBoardDao;
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<MinInfoBoard680Dto> findAll(final MinInfoBoard680Dto dto, Pageable pageable) { public Page<MinInfoBoard680Dto> findAll(final MinInfoBoard680Dto dto, Pageable pageable) {
return publicBoardDao.findAll(dto, pageable); return publicBoardDao.findAll(dto, pageable);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public MinInfoBoard680Dto findByInCode(final Long inCode) { public MinInfoBoard680Dto findByInCode(final Long inCode) {
return publicBoardDao.findByInCode(inCode); return publicBoardDao.findByInCode(inCode);
} }
@Override @Override
@Transactional //@Transactional
public void modifyByInCode(Long inCode) { public void modifyByInCode(Long inCode) {
publicBoardDao.updateInHitForMinInfoBoard680(inCode); publicBoardDao.updateInHitForMinInfoBoard680(inCode);
} }

@ -57,20 +57,20 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
// 관리자 // 관리자
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) { public Page<GnRecallScDto> findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) {
pageable = JpaUtil.getPagingInfo(pageable); pageable = JpaUtil.getPagingInfo(pageable);
return residentAndDisabledDao.findJudgeDatas(scDatagb, pageable); return residentAndDisabledDao.findJudgeDatas(scDatagb, pageable);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public GnRecallScDto findJudgeData(@NotNull final Long scCode) { public GnRecallScDto findJudgeData(@NotNull final Long scCode) {
return residentAndDisabledDao.findJudgeData(scCode); return residentAndDisabledDao.findJudgeData(scCode);
} }
@Override @Override
@Transactional //@Transactional
public void saveJudgeData(GnRecallScDto dto) { public void saveJudgeData(GnRecallScDto dto) {
boolean isNew = Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L; boolean isNew = Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L;
@ -102,19 +102,19 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
@Override @Override
@Transactional //@Transactional
public void removeJudgeData(@NotNull final Long scCode){ public void removeJudgeData(@NotNull final Long scCode){
residentAndDisabledDao.deleteJudgeData(scCode); residentAndDisabledDao.deleteJudgeData(scCode);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<JudgeTargetDto> findJudgeTargets(JudgeTargetDto dto) { public List<JudgeTargetDto> findJudgeTargets(JudgeTargetDto dto) {
return residentAndDisabledDao.findJudgeTargets(dto); return residentAndDisabledDao.findJudgeTargets(dto);
} }
@Override @Override
@Transactional //@Transactional
public void saveJudgeTargets(JudgeTargetDto dto) { public void saveJudgeTargets(JudgeTargetDto dto) {
boolean isFirst = true; boolean isFirst = true;
@ -165,7 +165,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) { public Page<JudgeListDto> findJudges(JudgeListDto dto, Pageable pageable) {
pageable = JpaUtil.getPagingInfo(pageable); pageable = JpaUtil.getPagingInfo(pageable);
@ -173,7 +173,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Map<String,Object> findJudgeResults(JudgeListDto dto) { public Map<String,Object> findJudgeResults(JudgeListDto dto) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
@ -232,7 +232,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
* @param dto ParkingTargetDto * @param dto ParkingTargetDto
*/ */
@Override @Override
@Transactional //@Transactional
public void removeJudge(@NotNull final JudgeListDto dto) { public void removeJudge(@NotNull final JudgeListDto dto) {
List<Long> msMaincodes = residentAndDisabledDao.findAllMsMaincode(dto); List<Long> msMaincodes = residentAndDisabledDao.findAllMsMaincode(dto);
@ -247,7 +247,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
} }
@Override @Override
@Transactional //@Transactional
public void saveJudgeStds(final JudgeStdDto dto) { public void saveJudgeStds(final JudgeStdDto dto) {
int stdCnt = dto.getJudgeStdCnt(); int stdCnt = dto.getJudgeStdCnt();
@ -275,7 +275,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
}); });
} }
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Map<String,Object> findDashboard(){ public Map<String,Object> findDashboard(){
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
@ -312,13 +312,13 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService {
// 심사자 // 심사자
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<JudgeListDto> findByUserJudges(JudgeListDto dto) { public List<JudgeListDto> findByUserJudges(JudgeListDto dto) {
return residentAndDisabledDao.findByUserJudges(dto); return residentAndDisabledDao.findByUserJudges(dto);
} }
@Override @Override
@Transactional //@Transactional
public void saveJudgeResult(JudgeListDto dto){ public void saveJudgeResult(JudgeListDto dto){
residentAndDisabledDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), residentAndDisabledDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(),
dto.getMsuResult(), dto.getMsuResult(),

@ -37,7 +37,7 @@ public class AuthorizationAspect {
@Before("execution(public * com.xit..controller.*Controller.*(..)) ") @Before("execution(public * com.xit..controller.*Controller.*(..)) ")
public void insertAdminLog(JoinPoint joinPoint) throws WeakKeyException, UnsupportedEncodingException, TokenAuthException { public void insertAdminLog(JoinPoint joinPoint) throws WeakKeyException, UnsupportedEncodingException, TokenAuthException {
SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes(StandardCharsets.UTF_8)); SecretKey key = Keys.hmacShaKeyFor(secretKey.getBytes("utf-8"));
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes()).getRequest();
String authorization = request.getHeader("Authorization"); String authorization = request.getHeader("Authorization");

@ -21,7 +21,7 @@ public class RequestLucyXssWrapper extends HttpServletRequestWrapper {
public RequestLucyXssWrapper(HttpServletRequest request) throws IOException { public RequestLucyXssWrapper(HttpServletRequest request) throws IOException {
super(request); super(request);
XssFilter filter = XssFilter.getInstance("lucy-xss-sax.xml"); XssFilter filter = XssFilter.getInstance("lucy-xss-sax.xml");
b = new String(filter.doFilter(getBody(request))).getBytes(StandardCharsets.UTF_8); b = new String(filter.doFilter(getBody(request))).getBytes("utf-8");
} }
public ServletInputStream getInputStream() throws IOException { public ServletInputStream getInputStream() throws IOException {
@ -67,7 +67,7 @@ public class RequestLucyXssWrapper extends HttpServletRequestWrapper {
try { try {
InputStream inputStream = request.getInputStream(); InputStream inputStream = request.getInputStream();
if (inputStream != null) { if (inputStream != null) {
br = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); br = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
char[] charBuffer = new char[128]; char[] charBuffer = new char[128];
int bytesRead = -1; int bytesRead = -1;
while ((bytesRead = br.read(charBuffer)) > 0) { while ((bytesRead = br.read(charBuffer)) > 0) {

@ -6,14 +6,11 @@ import com.xit.core.exception.CustomBaseException;
import com.xit.core.util.Checks; import com.xit.core.util.Checks;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.hibernate.JDBCException;
import org.hibernate.exception.GenericJDBCException;
import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException; import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
@ -21,7 +18,6 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
import javax.persistence.PersistenceException;
import javax.validation.ConstraintViolationException; import javax.validation.ConstraintViolationException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -197,10 +193,10 @@ public class CustomRestExceptionHandler extends ResponseEntityExceptionHandler {
log.error("handleException RuntimeException : {}", Checks.isEmpty(message) ? StringUtils.EMPTY : e.getClass().getCanonicalName()); log.error("handleException RuntimeException : {}", Checks.isEmpty(message) ? StringUtils.EMPTY : e.getClass().getCanonicalName());
// Hibernate SQL 예외인 경우 메세지 획득 // Hibernate SQL 예외인 경우 메세지 획득
if(e instanceof PersistenceException || e instanceof JDBCException || e instanceof JpaSystemException || e instanceof GenericJDBCException){ // if(e instanceof PersistenceException || e instanceof JDBCException || e instanceof JpaSystemException || e instanceof GenericJDBCException){
message = ((GenericJDBCException) e.getCause()).getSQLException().getLocalizedMessage(); // message = ((GenericJDBCException) e.getCause()).getSQLException().getLocalizedMessage();
//message = ((GenericJDBCException) e.getCause()).getSQLException().getLocalizedMessage(); // //message = ((GenericJDBCException) e.getCause()).getSQLException().getLocalizedMessage();
} // }
return RestErrorResponse.of(HttpStatus.INTERNAL_SERVER_ERROR.toString(), message); return RestErrorResponse.of(HttpStatus.INTERNAL_SERVER_ERROR.toString(), message);
} }

@ -9,8 +9,6 @@ import lombok.*;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ -29,7 +27,7 @@ public class LoginRequestDto {
* Enum type Validation -> controller * Enum type Validation -> controller
*/ */
@Schema(required = true, title = "Provider Type", example = "LOCAL", description = "Provider TYPE") @Schema(required = true, title = "Provider Type", example = "LOCAL", description = "Provider TYPE")
@Enumerated(EnumType.STRING) //@Enumerated(EnumType.STRING)
@Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}") @Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}")
private ProviderType providerType; private ProviderType providerType;

@ -6,24 +6,17 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/** /**
* (redis ) * (redis )
* RDB * RDB
*/ */
@Schema(name = "RefreshToken", description = "Refresh Token 테이블") @Schema(name = "RefreshToken", description = "Refresh Token 테이블")
@Table(name = "refresh_token")
@Entity
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
public class RefreshToken { public class RefreshToken {
@Schema(required = true, title = "사용자ID", example = " ", description = "사용자 ID") @Schema(required = true, title = "사용자ID", example = " ", description = "사용자 ID")
@Id
private String key; private String key;
@Schema(required = true, title = "refresh token", example = " ", description = "refresh token") @Schema(required = true, title = "refresh token", example = " ", description = "refresh token")

@ -1,16 +1,15 @@
package com.xit.core.support; package com.xit.core.support;
import org.springframework.jdbc.support.JdbcUtils;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public class CamelCaseLinkedMap extends LinkedHashMap { public class CamelCaseLinkedMap extends LinkedHashMap {
@Override @Override
public Object put(Object key, Object value){ public Object put(Object key, Object value){
if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); //if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value);
else return super.put(key, value); //else return super.put(key, value);
return super.put(key, value);
} }
} }

@ -1,6 +1,5 @@
package com.xit.core.support; package com.xit.core.support;
import org.springframework.jdbc.support.JdbcUtils;
import java.util.HashMap; import java.util.HashMap;
@ -9,7 +8,8 @@ public class CamelCaseMap<K, V> extends HashMap {
@Override @Override
public Object put(Object key, Object value){ public Object put(Object key, Object value){
if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); //if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value);
else return super.put(key, value); //else return super.put(key, value);
return super.put(key, value);
} }
} }

@ -10,61 +10,61 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
//@Transactional(value = "jpaTransactionManager") ////@Transactional(value = "jpaTransactionManager")
public abstract class AbstractJpaCrudService<T extends Serializable, ID> implements IJpaOperation<T, ID> { public abstract class AbstractJpaCrudService<T extends Serializable, ID> implements IJpaOperation<T, ID> {
protected abstract CrudRepository<T, ID> getRepository(); protected abstract CrudRepository<T, ID> getRepository();
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public T findOne(final ID id) { public T findOne(final ID id) {
return getRepository().findById(id).orElse(null); return getRepository().findById(id).orElse(null);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Optional<T> findById(final ID id) { public Optional<T> findById(final ID id) {
return getRepository().findById(id); return getRepository().findById(id);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<T> findAll() { public List<T> findAll() {
return Lists.newArrayList(getRepository().findAll()); return Lists.newArrayList(getRepository().findAll());
} }
@Override @Override
@Transactional //@Transactional
public T save(final T entity) { public T save(final T entity) {
return getRepository().save(entity); return getRepository().save(entity);
} }
@Override @Override
@Transactional //@Transactional
public T update(final T entity) { public T update(final T entity) {
return getRepository().save(entity); return getRepository().save(entity);
} }
@Override @Override
@Transactional //@Transactional
public void delete(final T entity) { public void delete(final T entity) {
getRepository().delete(entity); getRepository().delete(entity);
} }
@Override @Override
@Transactional //@Transactional
public void deleteById(final ID id) { public void deleteById(final ID id) {
getRepository().deleteById(id); getRepository().deleteById(id);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<T> findAll(final Pageable pageable) { public Page<T> findAll(final Pageable pageable) {
return null; return null;
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<T> findPaginated(final int page, final int size) { public Page<T> findPaginated(final int page, final int size) {
return null; return null;
} }

@ -11,37 +11,37 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
//@Transactional(value = "jpaTransactionManager") ////@Transactional(value = "jpaTransactionManager")
public abstract class AbstractJpaService<T extends Serializable, ID> implements IJpaOperation<T, ID> { public abstract class AbstractJpaService<T extends Serializable, ID> implements IJpaOperation<T, ID> {
protected abstract PagingAndSortingRepository<T, ID> getRepository(); protected abstract PagingAndSortingRepository<T, ID> getRepository();
// Paging // Paging
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<T> findAll(final Pageable pageable) { public Page<T> findAll(final Pageable pageable) {
return getRepository().findAll(pageable); return getRepository().findAll(pageable);
} }
// Paging // Paging
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Page<T> findPaginated(final int page, final int size) { public Page<T> findPaginated(final int page, final int size) {
return getRepository().findAll(PageRequest.of(page, size)); return getRepository().findAll(PageRequest.of(page, size));
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public T findOne(final ID id) { public T findOne(final ID id) {
return getRepository().findById(id).orElse(null); return getRepository().findById(id).orElse(null);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public Optional<T> findById(final ID id) { public Optional<T> findById(final ID id) {
return getRepository().findById(id); return getRepository().findById(id);
} }
@Override @Override
@Transactional(readOnly = true) //@Transactional(readOnly = true)
public List<T> findAll() { public List<T> findAll() {
return Lists.newArrayList(getRepository().findAll()); return Lists.newArrayList(getRepository().findAll());
} }
@ -50,25 +50,25 @@ public abstract class AbstractJpaService<T extends Serializable, ID> implements
// write // write
@Override @Override
@Transactional //@Transactional
public T save(final T entity) { public T save(final T entity) {
return getRepository().save(entity); return getRepository().save(entity);
} }
@Override @Override
@Transactional //@Transactional
public T update(final T entity) { public T update(final T entity) {
return getRepository().save(entity); return getRepository().save(entity);
} }
@Override @Override
@Transactional //@Transactional
public void delete(final T entity) { public void delete(final T entity) {
getRepository().delete(entity); getRepository().delete(entity);
} }
@Override @Override
@Transactional //@Transactional
public void deleteById(final ID id) { public void deleteById(final ID id) {
getRepository().deleteById(id); getRepository().deleteById(id);
} }

@ -3,14 +3,11 @@ package com.xit.core.support.jpa;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.hibernate.annotations.ColumnDefault;
import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
@ -21,56 +18,39 @@ import java.time.format.DateTimeFormatter;
* @see com.xit.core.support.jpa.AuditorAwareConfig * @see com.xit.core.support.jpa.AuditorAwareConfig
*/ */
@Schema(name = "AuditEntity", description = "감사 필드 정의") @Schema(name = "AuditEntity", description = "감사 필드 정의")
@EntityListeners(AuditingEntityListener.class)
@Getter @Getter
// JPA Entity 클래스들이 해당 클래스를 상속할 경우 정의한 필드 적용 // JPA Entity 클래스들이 해당 클래스를 상속할 경우 정의한 필드 적용
@MappedSuperclass
public class AuditEntity implements Serializable { public class AuditEntity implements Serializable {
private static final long serialVersionUID = 1146360965411496820L; private static final long serialVersionUID = 1146360965411496820L;
@Setter @Setter
@Schema(description = "생성시 생성자 자동 할당", example = " ") @Schema(description = "생성시 생성자 자동 할당", example = " ")
@CreatedBy @CreatedBy
@Column(name = "created_by", updatable = false, length = 64)
private String createdBy; private String createdBy;
@Setter @Setter
@Schema(description = "변경시 변경자 자동 할당", example = " ") @Schema(description = "변경시 변경자 자동 할당", example = " ")
@LastModifiedBy @LastModifiedBy
@Column(name = "modified_by", length = 64, insertable = false)
private String modifiedBy; private String modifiedBy;
@Setter @Setter
@Schema(description = "생성시 생성일시 자동 할당", example = " ") @Schema(description = "생성시 생성일시 자동 할당", example = " ")
@CreatedDate @CreatedDate
//@JsonIgnore
//@Temporal(TemporalType.TIMESTAMP)
//@Column(name = "created_dtm", updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Column(name = "created_dtm", updatable = false)
private LocalDateTime createdDtm; private LocalDateTime createdDtm;
@Setter @Setter
@Schema(description = "변경시 변경일시 자동 할당", example = " ") @Schema(description = "변경시 변경일시 자동 할당", example = " ")
@LastModifiedDate @LastModifiedDate
//@JsonIgnore
//@Temporal(TemporalType.TIMESTAMP)
//@Column(name = "modified_dtm", insertable = false, columnDefinition = "TIMESTAMP DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP")
@Column(name = "modified_dtm", insertable = false)
private LocalDateTime modifiedDtm; private LocalDateTime modifiedDtm;
@Schema(example = "Y", required = true) @Schema(example = "Y", required = true)
@Column(name = "use_yn", nullable = false, length = 1)
//@Column(name = "use_yn", nullable = false, length = 1)
@ColumnDefault(value = "'Y'")
private String useYn = "Y"; private String useYn = "Y";
@PrePersist
public void onPrePersist(){ public void onPrePersist(){
this.createdBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); this.createdBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
this.modifiedBy = this.createdBy; this.modifiedBy = this.createdBy;
} }
@PreUpdate
public void onPreUpdate(){ public void onPreUpdate(){
this.modifiedBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); this.modifiedBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
} }

@ -1,18 +0,0 @@
package com.xit.core.support.jpa;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;
import java.io.Serializable;
/**
* Repository
* NoRepositoryBean annotaion
*
* @author Lim, Jong Uk (minuk926)
* @since 2021-07-22
*/
@NoRepositoryBean
public interface ISimpleRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { //Repository<T, ID> {
boolean contains(T entity);
}

@ -4,7 +4,6 @@ import com.xit.core.util.Checks;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Objects; import java.util.Objects;
@ -25,26 +24,4 @@ public class JpaUtil {
// if(Checks.isEmpty(sort)) return PageRequest.of(limit*(page-1), limit); // if(Checks.isEmpty(sort)) return PageRequest.of(limit*(page-1), limit);
// else return PageRequest.of(limit*(page-1), limit, Objects.requireNonNull(sort)); // else return PageRequest.of(limit*(page-1), limit, Objects.requireNonNull(sort));
} }
/**
*
* @param id Long
* @param repository JpaRepository
* @param entity Object
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public static void saveIfNullId(Long id, JpaRepository repository, Object entity) {
if(id == null) repository.save(entity);
}
/**
*
* @param id Long
* @param repository JpaRepository
* @param entity Object
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public static void saveIfNullId(String id, JpaRepository repository, Object entity) {
if(id == null) repository.save(entity);
}
} }

@ -1,36 +0,0 @@
package com.xit.core.support.jpa;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import javax.persistence.EntityManager;
import java.io.Serializable;
/**
*
* @EnableJpaRepositories repositoryBaseClass
* Repository ISimpleRepository
*
* querydsl
* ( SimpleJpaRepository QuerydslJpaRepository
* deprecated )
*
* @param <T>
* @param <ID>
*/
//public class SimpleBaseRepository<T, ID extends Serializable> extends QuerydslJpaRepository<T, ID> implements ISimpleRepository<T, ID>{
public class SimpleBaseRepository<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements ISimpleRepository<T, ID>{
private final EntityManager em;
public SimpleBaseRepository(JpaEntityInformation<T, ?> entityInformation, EntityManager em) {
super(entityInformation, em);
this.em = em;
}
@Override
public boolean contains(T entity) {
return em.contains(entity);
}
}

@ -207,16 +207,16 @@ public class AwsFileUtil {
if (userAgent.contains("MSIE 5.5")) { if (userAgent.contains("MSIE 5.5")) {
// MS IE 5.5 이하 // MS IE 5.5 이하
return URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "\\ "); return URLEncoder.encode(fileName, "utf-8").replaceAll("\\+", "\\ ");
} else if (userAgent.contains("MSIE")) { } else if (userAgent.contains("MSIE")) {
// MS IE (&#xBCF4;&#xD1B5;&#xC740; 6.x &#xC774;&#xC0C1; &#xAC00;&#xC815;) // MS IE (&#xBCF4;&#xD1B5;&#xC740; 6.x &#xC774;&#xC0C1; &#xAC00;&#xC815;)
return URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "\\ "); return URLEncoder.encode(fileName, "utf-8").replaceAll("\\+", "\\ ");
} else if (userAgent.contains("Trident")) { } else if (userAgent.contains("Trident")) {
// MS IE 11 // MS IE 11
return URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "\\ "); return URLEncoder.encode(fileName, "utf-8").replaceAll("\\+", "\\ ");
} else { } else {
// 모질라나 오페라 // 모질라나 오페라
return new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); return new String(fileName.getBytes("utf-8"), StandardCharsets.ISO_8859_1);
} }
} }

@ -585,7 +585,7 @@ public class CommUtil {
String encodedFilename = ""; String encodedFilename = "";
try { try {
String encodedFilename1 = "\"" + new String(filename.getBytes(StandardCharsets.UTF_8), "8859_1") + "\""; String encodedFilename1 = "\"" + new String(filename.getBytes("utf-8"), "8859_1") + "\"";
switch (browser) { switch (browser) {
case "Firefox": case "Firefox":
@ -597,7 +597,7 @@ public class CommUtil {
for (int i = 0; i < filename.length(); i++) { for (int i = 0; i < filename.length(); i++) {
char c = filename.charAt(i); char c = filename.charAt(i);
if (c > '~') { if (c > '~') {
sb.append(URLEncoder.encode("" + c, StandardCharsets.UTF_8)); sb.append(URLEncoder.encode("" + c, "utf-8"));
} else { } else {
sb.append(c); sb.append(c);
} }
@ -605,7 +605,7 @@ public class CommUtil {
encodedFilename = sb.toString(); encodedFilename = sb.toString();
break; break;
default: default:
encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); // MSIE 외 모든 브라우저 encodedFilename = URLEncoder.encode(filename, "utf-8").replaceAll("\\+", "%20"); // MSIE 외 모든 브라우저
break; break;
} }

@ -49,9 +49,9 @@ public class ConvertUtils {
return java.util.Date.from(instant); return java.util.Date.from(instant);
} }
public static LocalDate toLocalDateFromDate(java.util.Date date){ // public static LocalDate toLocalDateFromDate(java.util.Date date){
return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); // return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault());
} // }
public static LocalDateTime toLocalDateTimeFromDate(java.util.Date date){ public static LocalDateTime toLocalDateTimeFromDate(java.util.Date date){
return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());

@ -32,10 +32,10 @@ public class DateUtil {
//return java.sql.Timestamp.valueOf(localDateTime); //return java.sql.Timestamp.valueOf(localDateTime);
} }
public static LocalDate toLocalDateFromDate(Date date){ // public static LocalDate toLocalDateFromDate(Date date){
return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); // return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault());
//return new java.sql.Date(date.getTime()).toLocalDate(); // //return new java.sql.Date(date.getTime()).toLocalDate();
} // }
public static LocalDateTime toLocalDateTimeFromDate(Date date){ public static LocalDateTime toLocalDateTimeFromDate(Date date){
return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());

@ -51,10 +51,10 @@ public class PoiExcelView extends AbstractXlsxView {
encodedFilename = filename; encodedFilename = filename;
}else if (Objects.equals("MSIE", browser) || Objects.equals("Trident", browser)) {// IE11 문자열 깨짐 방지 }else if (Objects.equals("MSIE", browser) || Objects.equals("Trident", browser)) {// IE11 문자열 깨짐 방지
encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); encodedFilename = URLEncoder.encode(filename, "utf-8").replaceAll("\\+", "%20");
} else { } else {
String encodedFilename1 = "\"" + new String(filename.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1) + "\""; String encodedFilename1 = "\"" + new String(filename.getBytes("utf-8"), StandardCharsets.ISO_8859_1) + "\"";
if (Objects.equals("Firefox", browser)) { if (Objects.equals("Firefox", browser)) {
encodedFilename = encodedFilename1; encodedFilename = encodedFilename1;
@ -66,7 +66,7 @@ public class PoiExcelView extends AbstractXlsxView {
for (int i = 0; i < filename.length(); i++) { for (int i = 0; i < filename.length(); i++) {
char c = filename.charAt(i); char c = filename.charAt(i);
if (c > '~') { if (c > '~') {
sb.append(URLEncoder.encode("" + c, StandardCharsets.UTF_8)); sb.append(URLEncoder.encode("" + c, "utf-8"));
} else { } else {
sb.append(c); sb.append(c);
} }

Loading…
Cancel
Save