From faa273f3828d5eeb97c0f51d37c686996abc92fe Mon Sep 17 00:00:00 2001 From: minuk926 Date: Thu, 7 Jul 2022 20:36:25 +0900 Subject: [PATCH] config: config set --- build.gradle | 6 +-- .../java/com/xit/biz/cmm/dto/CmmUserDto.java | 8 ++-- .../java/com/xit/biz/cmm/entity/CmmUser.java | 46 ------------------- .../xit/biz/cmm/entity/ids/CmmCodeSIds.java | 5 -- .../auth/service/impl/AuthMinService.java | 12 ++--- .../java/com/xit/biz/ctgy/dto/BoardDto.java | 1 - .../xit/biz/ctgy/dto/LoginMinRequestDto.java | 4 +- .../xit/biz/ctgy/dto/MinInfoBoard680Dto.java | 3 -- .../biz/ctgy/dto/MinSimsaUser680ScDto.java | 1 - .../com/xit/biz/ctgy/entity/MinUserinfo.java | 21 --------- .../ctgy/v2/controller/CmmFileController.java | 7 ++- .../v2/controller/CtgyFileMgtController.java | 9 +++- .../ctgy/v2/controller/MinUserController.java | 4 +- .../v2/controller/OAuth2MinController.java | 2 +- .../ctgy/v2/service/impl/BoardService.java | 4 +- .../ctgy/v2/service/impl/CmmCodeService.java | 4 +- .../ctgy/v2/service/impl/CmmFileService.java | 2 +- .../ctgy/v2/service/impl/CtgyFileService.java | 4 +- .../ctgy/v2/service/impl/MinUserService.java | 10 ++-- .../ctgy/v2/service/impl/ParkingService.java | 12 ++--- .../v2/service/impl/PublicBoardService.java | 6 +-- .../impl/ResidentAndDisabledService.java | 26 +++++------ .../xit/core/config/AuthorizationAspect.java | 2 +- .../filter/xss/RequestLucyXssWrapper.java | 4 +- .../handling/CustomRestExceptionHandler.java | 12 ++--- .../core/oauth2/api/dto/LoginRequestDto.java | 4 +- .../core/oauth2/api/entity/RefreshToken.java | 7 --- .../xit/core/support/CamelCaseLinkedMap.java | 9 ++-- .../com/xit/core/support/CamelCaseMap.java | 6 +-- .../support/jpa/AbstractJpaCrudService.java | 20 ++++---- .../core/support/jpa/AbstractJpaService.java | 20 ++++---- .../com/xit/core/support/jpa/AuditEntity.java | 20 -------- .../core/support/jpa/ISimpleRepository.java | 18 -------- .../com/xit/core/support/jpa/JpaUtil.java | 23 ---------- .../support/jpa/SimpleBaseRepository.java | 36 --------------- .../java/com/xit/core/util/AwsFileUtil.java | 8 ++-- src/main/java/com/xit/core/util/CommUtil.java | 6 +-- .../java/com/xit/core/util/ConvertUtils.java | 6 +-- src/main/java/com/xit/core/util/DateUtil.java | 8 ++-- .../java/com/xit/core/util/PoiExcelView.java | 6 +-- 40 files changed, 116 insertions(+), 296 deletions(-) delete mode 100644 src/main/java/com/xit/core/support/jpa/ISimpleRepository.java delete mode 100644 src/main/java/com/xit/core/support/jpa/SimpleBaseRepository.java diff --git a/build.gradle b/build.gradle index 434d5a5..9613935 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ plugins { group = 'com.xit' version = '0.0.1-SNAPSHOT' description = 'xit-opst-be' -sourceCompatibility = '11' +sourceCompatibility = '1.8' // WAS로 배포하는 경우 : 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-configuration-processor' implementation 'org.springframework.boot:spring-boot-starter-security' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'org.springframework.boot:spring-boot-starter-jdbc' + //implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + //implementation 'org.springframework.boot:spring-boot-starter-jdbc' // config 암호화 사용 implementation 'com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.3' diff --git a/src/main/java/com/xit/biz/cmm/dto/CmmUserDto.java b/src/main/java/com/xit/biz/cmm/dto/CmmUserDto.java index ac18fee..ad7e199 100644 --- a/src/main/java/com/xit/biz/cmm/dto/CmmUserDto.java +++ b/src/main/java/com/xit/biz/cmm/dto/CmmUserDto.java @@ -9,8 +9,8 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import org.springframework.security.crypto.password.PasswordEncoder; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; +//import javax.persistence.EnumType; +//import javax.persistence.Enumerated; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; @@ -59,13 +59,13 @@ public class CmmUserDto implements Serializable { //extends RepresentationModel< private String email; @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}") private RoleType roleType; ////////////////////////// Socail 사용시 //////////////////////////////////////////////////////////////// @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}") private ProviderType providerType; diff --git a/src/main/java/com/xit/biz/cmm/entity/CmmUser.java b/src/main/java/com/xit/biz/cmm/entity/CmmUser.java index b6eb7a2..c532473 100644 --- a/src/main/java/com/xit/biz/cmm/entity/CmmUser.java +++ b/src/main/java/com/xit/biz/cmm/entity/CmmUser.java @@ -6,27 +6,13 @@ import com.xit.core.oauth2.oauth.entity.RoleType; import com.xit.core.support.jpa.AuditEntity; import io.swagger.v3.oas.annotations.media.Schema; 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.Size; import java.io.Serializable; import java.util.Objects; @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 @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @@ -37,72 +23,47 @@ public class CmmUser extends AuditEntity implements Serializable { //extends Rep @Setter @JsonProperty(access = JsonProperty.Access.READ_ONLY) @Schema(required = true, title = "사용자ID(PK)", example = "W000000001") - @Id - @Column(name = "cmm_user_id", length = 64) private String cmmUserId; @Setter @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; //TODO : ??? @Setter @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) @Schema(required = true, title = "사용자 비밀번호", example = "minuk926") - @Column(name="password", length = 128, nullable = false) //@NotNull //@Size(max = 128) private String password; @Setter @Schema(required = true, title = "사용자 이름", example = "홍길동") - @Column(name="user_name", length = 100, nullable = false) - //@NotNull - //@Size(max = 100) private String userName; @Setter @Schema(title = "사용자 이메일", example = "a@b.com") - @Column(name="email", length = 100, nullable = false) - //@Size(max = 100) private String email; @Setter @Schema(title = "전화번호", example = "01012341234") - @Column(name="user_mbl", length = 100) - //@Size(max = 128) private String userMbl; @Setter - @Column(name = "role_type", length = 20, nullable = false) - @Enumerated(EnumType.STRING) - //@NotNull private RoleType roleType; /////////////////////////// Social login 관련 //////////////////////////////////// @Setter - @Column(name = "provider_type", length = 50, nullable = false) - @Enumerated(EnumType.STRING) - //@NotNull private ProviderType providerType; @Setter @Schema(title = "프로필이미지URL", example = " ", description = "SNS로 로그인시 필수") - @Column(name = "profile_image_url", length = 256) - //@NotNull - //@Size(max = 256) private String profileImageUrl; @Builder.Default @Setter - @Column(name = "email_verified_yn", length = 1, nullable = false) - //@NotNull - //@Size(min = 1, max = 1) private String emailVerifiedYn = "N"; 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 public int hashCode() { diff --git a/src/main/java/com/xit/biz/cmm/entity/ids/CmmCodeSIds.java b/src/main/java/com/xit/biz/cmm/entity/ids/CmmCodeSIds.java index 971f302..bdde7c6 100644 --- a/src/main/java/com/xit/biz/cmm/entity/ids/CmmCodeSIds.java +++ b/src/main/java/com/xit/biz/cmm/entity/ids/CmmCodeSIds.java @@ -3,7 +3,6 @@ package com.xit.biz.cmm.entity.ids; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import javax.persistence.Column; import java.io.Serializable; @Schema(name = "CmmCodeSIds", description = "소분류코드 PK(ClassIds) && 콤보코드 조회시 파라메터(searchKeyDto)로 사용") @@ -14,18 +13,14 @@ import java.io.Serializable; public class CmmCodeSIds implements Serializable { @Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID") - @Column(name = "code_grp_id", nullable = false, length = 20) private String codeGrpId; @Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류 코드값") - @Column(name = "code_lcd", nullable = false, length = 10) private String codeLcd; @Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값") - @Column(name = "code_mcd", nullable = false, length = 10) private String codeMcd; @Schema(required = true, title = "공통코드 코드", example = "001", description = "공통코드의 코드값") - @Column(name = "code_cd", nullable = false, length = 10) private String codeCd; } diff --git a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java index 178d59c..624374a 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java +++ b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java @@ -73,7 +73,7 @@ public class AuthMinService implements IAuthMinService { * @return TokenDto */ @Override - @Transactional + //@Transactional public TokenDto login(final LoginMinRequestDto loginRequestDto, HttpServletRequest request, HttpServletResponse response, @@ -197,7 +197,7 @@ public class AuthMinService implements IAuthMinService { * @return TokenDto */ @Override - @Transactional + //@Transactional public TokenDto reissue(final TokenRequestDto tokenRequestDto, HttpServletRequest request, HttpServletResponse response) { TokenDto tokenDto = new TokenDto(); String sAccessToken = null; @@ -291,28 +291,28 @@ public class AuthMinService implements IAuthMinService { } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public boolean validationToken(final String accessToken, final boolean isExceptionThrow) { return jwtTokenProvider.validateTokenExcludeExpired(accessToken, false, isExceptionThrow); } // TODO :: 적용 필요 @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Map findAccessTokenInfo(String accessToken) { return jwtTokenProvider.getAccessTokenInfo(accessToken); //authTokenProvider.getAccessTokenInfo(accessToken); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Optional findMyUserWithoutAuthorities() { //cmmUserRepos return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Optional findUserWithAuthorities(final String userId) { return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(userId); } diff --git a/src/main/java/com/xit/biz/ctgy/dto/BoardDto.java b/src/main/java/com/xit/biz/ctgy/dto/BoardDto.java index c273e8b..dbe7864 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/BoardDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/BoardDto.java @@ -4,7 +4,6 @@ import com.xit.core.oauth2.utils.HeaderUtil; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import javax.persistence.Transient; import java.io.Serializable; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; diff --git a/src/main/java/com/xit/biz/ctgy/dto/LoginMinRequestDto.java b/src/main/java/com/xit/biz/ctgy/dto/LoginMinRequestDto.java index 74a7d51..b33c623 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/LoginMinRequestDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/LoginMinRequestDto.java @@ -9,8 +9,6 @@ import lombok.*; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.crypto.password.PasswordEncoder; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @@ -29,7 +27,7 @@ public class LoginMinRequestDto { * Enum type Validation -> controller에서 처리 */ @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}") private ProviderType providerType; diff --git a/src/main/java/com/xit/biz/ctgy/dto/MinInfoBoard680Dto.java b/src/main/java/com/xit/biz/ctgy/dto/MinInfoBoard680Dto.java index 07e02c0..47b16c8 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinInfoBoard680Dto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinInfoBoard680Dto.java @@ -9,8 +9,6 @@ import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.web.multipart.MultipartFile; -import javax.persistence.Column; -import javax.persistence.Transient; import java.io.Serializable; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -65,7 +63,6 @@ public class MinInfoBoard680Dto implements Serializable { @Schema(required = false, title = "기타", example = " ", description = "Input Description...") private String inEtc; - @Transient @Schema(required = false, title = "파일", example = " ", description = "파일") private MultipartFile[] files; diff --git a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaUser680ScDto.java b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaUser680ScDto.java index ce3bc20..e9166c5 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaUser680ScDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaUser680ScDto.java @@ -3,7 +3,6 @@ package com.xit.biz.ctgy.dto; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import javax.persistence.*; import java.time.LocalDate; @Schema(name = "MinSimsaUser680ScDto", description = "거주자/장애인 심사사용자매핑") diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java index a2b9b70..fe1a9ac 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java @@ -2,11 +2,8 @@ package com.xit.biz.ctgy.entity; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import org.hibernate.annotations.DynamicInsert; -import org.hibernate.annotations.DynamicUpdate; import org.springframework.data.domain.Persistable; -import javax.persistence.*; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -17,60 +14,44 @@ import java.util.Objects; * Persistable 구현 필요 : persitance 처리시 신규인지 체크에 필요한 getId 와 isNew Override */ @Schema(name = "MinUserinfo", description = "null") -@Table(name = "min_userinfo", schema = "", catalog = "") -@Entity -@DynamicInsert -@DynamicUpdate @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) @Getter @Builder public class MinUserinfo implements Persistable { - @Id @Schema(required = true, title = "민원심사사용자코드", example = " ", description = "Input Description...") - @Column(name = "userid", nullable = false, length = 20) private String userid; @Schema(required = true, title = "사용자암호", example = " ", description = "Input Description...") - @Column(name = "passwd", nullable = false, length = 48) private String passwd; @Schema(required = true, title = "사용자성명", example = " ", description = "Input Description...") - @Column(name = "name", nullable = false, length = 100) private String name; @Schema(required = false, title = "사용자주민번호", example = " ", description = "Input Description...") - @Column(name = "regnum", nullable = true, length = 20) private String regnum; @Schema(required = false, title = "전화번호", example = " ", description = "Input Description...") - @Column(name = "mphone", nullable = true, length = 20) private String mphone; @Schema(required = false, title = "이메일", example = " ", description = "Input Description...") - @Column(name = "email", nullable = true, length = 20) private String email; @Schema(required = true, title = "사용구분", example = " ", description = "Input Description...") - @Column(name = "accesstype", nullable = true, length = 3) private String accesstype; @Schema(required = true, title = "단속조", example = " ", description = "Input Description...") - @Column(name = "team", nullable = true, length = 3) private String team; @Schema(required = false, title = "등록일시", example = " ", description = "Input Description...") - @Column(name = "regdate", nullable = true) private LocalDate regdate; @Schema(required = false, title = "사용여부", example = " ", description = "Input Description...") - @Column(name = "isenable", nullable = true, length = 1) @Setter private String isenable; @Schema(required = false, title = "구청코드", example = " ", description = "Input Description...") - @Column(name = "gu", nullable = true, length = 3) private String gu; @@ -85,7 +66,6 @@ public class MinUserinfo implements Persistable { } - @PrePersist public void onPrePersist(){ LocalDateTime localDateTime = LocalDateTime.now(); this.regdate = LocalDate.parse(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); @@ -93,7 +73,6 @@ public class MinUserinfo implements Persistable { this.gu = "680"; } - @PreUpdate public void onPreUpdate(){ // LocalDateTime localDateTime = LocalDateTime.now(); // this.inNalja = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java index b263271..d28d9be 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/CmmFileController.java @@ -24,6 +24,7 @@ import javax.annotation.Nonnull; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URLEncoder; @@ -127,7 +128,11 @@ public class CmmFileController { response.setContentType(contentType); response.setHeader(HttpHeaders.CONTENT_TYPE, contentType); 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_LENGTH, String.valueOf(fileSize)); try { diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java index 1634e8c..4ee454e 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/CtgyFileMgtController.java @@ -24,6 +24,7 @@ import javax.annotation.Nonnull; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.nio.file.Files; @@ -105,7 +106,11 @@ public class CtgyFileMgtController { response.setContentType(contentType); response.setHeader(HttpHeaders.CONTENT_TYPE, contentType); 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_LENGTH, String.valueOf(dto.getInFilesize())); try { @@ -149,7 +154,7 @@ public class CtgyFileMgtController { headers.add(HttpHeaders.CONTENT_TYPE, contentType); headers.setContentDisposition(ContentDisposition.builder("attachment") .filename(entity.getInFilename(), StandardCharsets.UTF_8) - //.filename(URLEncoder.encode(entity.getInFilename(), StandardCharsets.UTF_8)) + //.filename(URLEncoder.encode(entity.getInFilename(), "utf-8")) .build()); headers.add(HttpHeaders.CONTENT_LENGTH, String.valueOf(entity.getInFilesize())); diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/MinUserController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/MinUserController.java index dba49ed..4c20484 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/MinUserController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/MinUserController.java @@ -52,14 +52,14 @@ public class MinUserController { @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") @GetMapping("/info") @Secured(policy = SecurityPolicy.TOKEN) - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public ResponseEntity getMinUser() { return RestResponse.of(service.findMinUser()); } @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") @GetMapping("/{userid}") - //@Transactional(readOnly = true) + ////@Transactional(readOnly = true) public ResponseEntity getMinUser(@PathVariable final String userid) { return RestResponse.of(service.findMinUserByUserid(userid)); } diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/OAuth2MinController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/OAuth2MinController.java index 9e001b8..871c470 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/OAuth2MinController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/OAuth2MinController.java @@ -58,7 +58,7 @@ public class OAuth2MinController { */ @Operation(summary = "login" , description = "login") @PostMapping("/login") - @Transactional + //@Transactional public ResponseEntity login( @Valid @RequestBody diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java index 5ad2259..8c890aa 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/BoardService.java @@ -35,7 +35,7 @@ public class BoardService implements IBoardService { } @Override - @Transactional + //@Transactional public void saveBoard(BoardDto dto) { // update 인 경우 @@ -61,7 +61,7 @@ public class BoardService implements IBoardService { } @Override - @Transactional + //@Transactional public void removeBoard(final Long ciCode) { BoardDto savedDto = boardDao.findById(ciCode).orElseThrow(() -> new CustomBaseException(ErrorCode.NOT_FOUND)); diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmCodeService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmCodeService.java index 8211482..e0692fc 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmCodeService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmCodeService.java @@ -85,7 +85,7 @@ public class CmmCodeService implements ICmmCodeService { // } // // @Override -// @Transactional +// //@Transactional // public CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp) { // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeGrpId()), "코드 그룹을 입력해 주세요."); // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeNm()), "코드 그룹명 입력해 주세요."); @@ -93,7 +93,7 @@ public class CmmCodeService implements ICmmCodeService { // return cmmCodeGrpRepository.save(cmmCodeGrp); // } // -// @Transactional +// //@Transactional // @Override // public Object saveCmmCode(CmmCodeDto cmmCodeDto) { // AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "코드그룹을 입력해 주세요."); diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmFileService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmFileService.java index adda10a..56198e5 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmFileService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CmmFileService.java @@ -36,7 +36,7 @@ public class CmmFileService implements ICmmFileService { * @return String makePath */ @Override - @Transactional + //@Transactional public String uploadFiles(MultipartFile[] files, String rootPath, String uploadPath) { String makePath = ""; diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java index de62651..a991eb0 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/CtgyFileService.java @@ -59,7 +59,7 @@ public class CtgyFileService implements ICtgyFileService { * @return CmmFileMst */ @Override - @Transactional + //@Transactional public List saveFiles(@Nonnull MinInfoBoard680Dto dto) { List entityList = new ArrayList<>(); MultipartFile[] files = dto.getFiles(); @@ -133,7 +133,7 @@ public class CtgyFileService implements ICtgyFileService { } @Override - @Transactional + //@Transactional public void removePublicBoardFile(Long inCode) { MinInfoBoard680Dto savedEntity = publicBoardDao.findByInCode(inCode); diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java index 9ea98f9..9166c98 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java @@ -22,26 +22,26 @@ public class MinUserService implements IMinUserService { private final PasswordEncoder passwordEncoder; private final UserDao userDao; - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findMinUsers(final MinUserinfoDto dto, Pageable pageable) { pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()); return userDao.findMinUserList(dto, pageable); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public MinUserinfoDto findMinUser() { return userDao.findByUserid(HeaderUtil.getUserId()).orElse(null); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public MinUserinfoDto findMinUserByUserid(final String userid) { return userDao.findByUserid(userid).orElse(null); } @Override - @Transactional + //@Transactional public void saveMinUser(MinUserinfoDto dto) { Optional opUser = userDao.findByUserid(dto.getUserid()); dto.setPasswd(passwordEncoder.encode(dto.getPasswd())); @@ -57,7 +57,7 @@ public class MinUserService implements IMinUserService { } @Override - @Transactional + //@Transactional public void removeMinUser(MinUserinfoDto dto) { dto.setIsenable("0"); userDao.removeMinUserinfo(dto); diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java index ba91cd7..6b03589 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java @@ -32,7 +32,7 @@ public class ParkingService implements IParkingService { private final UserDao userDao; @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findParkings(final JudgeListDto dto, Pageable pageable) { return parkingDao.findParkings(dto, pageable); } @@ -87,13 +87,13 @@ public class ParkingService implements IParkingService { } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findParkingJudgeTargets(ParkingTargetDto dto) { return parkingDao.findParkingJudgeTargets(dto); } @Override - @Transactional + //@Transactional public void saveParkingJudgeTargets(ParkingTargetDto dto) { boolean isFirst = true; @@ -152,7 +152,7 @@ public class ParkingService implements IParkingService { * @param dto ParkingTargetDto */ @Override - @Transactional + //@Transactional public void removeParkingJudge(final ParkingTargetDto dto) { List msMaincodes = parkingDao.findAllMsMaincode(dto); @@ -169,13 +169,13 @@ public class ParkingService implements IParkingService { // 심사자 //--------------------------------------------------------------------------------- @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findByUserJudges() { return parkingDao.findByUserJudges(); } @Override - @Transactional + //@Transactional public void saveJudgeResult(JudgeListDto dto){ parkingDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), dto.getMsuResult(), diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/PublicBoardService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/PublicBoardService.java index e3e8d93..588ce29 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/PublicBoardService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/PublicBoardService.java @@ -15,19 +15,19 @@ public class PublicBoardService implements IPublicBoardService { private final PublicBoardDao publicBoardDao; @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findAll(final MinInfoBoard680Dto dto, Pageable pageable) { return publicBoardDao.findAll(dto, pageable); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public MinInfoBoard680Dto findByInCode(final Long inCode) { return publicBoardDao.findByInCode(inCode); } @Override - @Transactional + //@Transactional public void modifyByInCode(Long inCode) { publicBoardDao.updateInHitForMinInfoBoard680(inCode); } diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java index 004b371..3eb7461 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java @@ -57,20 +57,20 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { // 관리자 //--------------------------------------------------------------------------------- @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) { pageable = JpaUtil.getPagingInfo(pageable); return residentAndDisabledDao.findJudgeDatas(scDatagb, pageable); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public GnRecallScDto findJudgeData(@NotNull final Long scCode) { return residentAndDisabledDao.findJudgeData(scCode); } @Override - @Transactional + //@Transactional public void saveJudgeData(GnRecallScDto dto) { boolean isNew = Checks.isEmpty(dto.getScCode()) || dto.getScCode() == 0L; @@ -102,19 +102,19 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { @Override - @Transactional + //@Transactional public void removeJudgeData(@NotNull final Long scCode){ residentAndDisabledDao.deleteJudgeData(scCode); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findJudgeTargets(JudgeTargetDto dto) { return residentAndDisabledDao.findJudgeTargets(dto); } @Override - @Transactional + //@Transactional public void saveJudgeTargets(JudgeTargetDto dto) { boolean isFirst = true; @@ -165,7 +165,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findJudges(JudgeListDto dto, Pageable pageable) { pageable = JpaUtil.getPagingInfo(pageable); @@ -173,7 +173,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Map findJudgeResults(JudgeListDto dto) { Map resultMap = new HashMap<>(); @@ -232,7 +232,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { * @param dto ParkingTargetDto */ @Override - @Transactional + //@Transactional public void removeJudge(@NotNull final JudgeListDto dto) { List msMaincodes = residentAndDisabledDao.findAllMsMaincode(dto); @@ -247,7 +247,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } @Override - @Transactional + //@Transactional public void saveJudgeStds(final JudgeStdDto dto) { int stdCnt = dto.getJudgeStdCnt(); @@ -275,7 +275,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { }); } - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Map findDashboard(){ Map resultMap = new HashMap<>(); @@ -312,13 +312,13 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { // 심사자 //--------------------------------------------------------------------------------- @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findByUserJudges(JudgeListDto dto) { return residentAndDisabledDao.findByUserJudges(dto); } @Override - @Transactional + //@Transactional public void saveJudgeResult(JudgeListDto dto){ residentAndDisabledDao.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), dto.getMsuResult(), diff --git a/src/main/java/com/xit/core/config/AuthorizationAspect.java b/src/main/java/com/xit/core/config/AuthorizationAspect.java index ad6fc0e..b9b43c1 100644 --- a/src/main/java/com/xit/core/config/AuthorizationAspect.java +++ b/src/main/java/com/xit/core/config/AuthorizationAspect.java @@ -37,7 +37,7 @@ public class AuthorizationAspect { @Before("execution(public * com.xit..controller.*Controller.*(..)) ") 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(); String authorization = request.getHeader("Authorization"); diff --git a/src/main/java/com/xit/core/config/filter/xss/RequestLucyXssWrapper.java b/src/main/java/com/xit/core/config/filter/xss/RequestLucyXssWrapper.java index 95fcd85..30b907f 100644 --- a/src/main/java/com/xit/core/config/filter/xss/RequestLucyXssWrapper.java +++ b/src/main/java/com/xit/core/config/filter/xss/RequestLucyXssWrapper.java @@ -21,7 +21,7 @@ public class RequestLucyXssWrapper extends HttpServletRequestWrapper { public RequestLucyXssWrapper(HttpServletRequest request) throws IOException { super(request); 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 { @@ -67,7 +67,7 @@ public class RequestLucyXssWrapper extends HttpServletRequestWrapper { try { InputStream inputStream = request.getInputStream(); 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]; int bytesRead = -1; while ((bytesRead = br.read(charBuffer)) > 0) { diff --git a/src/main/java/com/xit/core/exception/handling/CustomRestExceptionHandler.java b/src/main/java/com/xit/core/exception/handling/CustomRestExceptionHandler.java index 24f3bcb..aa889fb 100644 --- a/src/main/java/com/xit/core/exception/handling/CustomRestExceptionHandler.java +++ b/src/main/java/com/xit/core/exception/handling/CustomRestExceptionHandler.java @@ -6,14 +6,11 @@ import com.xit.core.exception.CustomBaseException; import com.xit.core.util.Checks; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.hibernate.JDBCException; -import org.hibernate.exception.GenericJDBCException; import org.springframework.dao.DataIntegrityViolationException; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.http.converter.HttpMessageNotReadableException; -import org.springframework.orm.jpa.JpaSystemException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; 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.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; -import javax.persistence.PersistenceException; import javax.validation.ConstraintViolationException; import java.util.HashMap; 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()); // Hibernate SQL 예외인 경우 메세지 획득 - 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(); - } +// 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(); +// } return RestErrorResponse.of(HttpStatus.INTERNAL_SERVER_ERROR.toString(), message); } diff --git a/src/main/java/com/xit/core/oauth2/api/dto/LoginRequestDto.java b/src/main/java/com/xit/core/oauth2/api/dto/LoginRequestDto.java index ef7ffbe..0da468d 100644 --- a/src/main/java/com/xit/core/oauth2/api/dto/LoginRequestDto.java +++ b/src/main/java/com/xit/core/oauth2/api/dto/LoginRequestDto.java @@ -9,8 +9,6 @@ import lombok.*; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.crypto.password.PasswordEncoder; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; import javax.validation.constraints.NotNull; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; @@ -29,7 +27,7 @@ public class LoginRequestDto { * Enum type Validation -> controller에서 처리 */ @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}") private ProviderType providerType; diff --git a/src/main/java/com/xit/core/oauth2/api/entity/RefreshToken.java b/src/main/java/com/xit/core/oauth2/api/entity/RefreshToken.java index 5b2ef07..ece9478 100644 --- a/src/main/java/com/xit/core/oauth2/api/entity/RefreshToken.java +++ b/src/main/java/com/xit/core/oauth2/api/entity/RefreshToken.java @@ -6,24 +6,17 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Table; - /** * 토큰 만료시 자동 삭제되도록 해야 함(redis 사용) * RDB 사용시 배치로 만료된 토큰 삭제처리 */ @Schema(name = "RefreshToken", description = "Refresh Token 테이블") -@Table(name = "refresh_token") -@Entity @Getter @Setter @NoArgsConstructor public class RefreshToken { @Schema(required = true, title = "사용자ID", example = " ", description = "사용자 ID") - @Id private String key; @Schema(required = true, title = "refresh token", example = " ", description = "refresh token") diff --git a/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java b/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java index dbb8a6d..2544271 100644 --- a/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java +++ b/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java @@ -1,16 +1,15 @@ package com.xit.core.support; -import org.springframework.jdbc.support.JdbcUtils; - import java.util.LinkedHashMap; -import java.util.Map; @SuppressWarnings("rawtypes") public class CamelCaseLinkedMap extends LinkedHashMap { @Override public Object put(Object key, Object value){ - if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); - else return super.put(key, value); + //if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); + //else return super.put(key, value); + return super.put(key, value); } } + diff --git a/src/main/java/com/xit/core/support/CamelCaseMap.java b/src/main/java/com/xit/core/support/CamelCaseMap.java index e13c5f5..20a0905 100644 --- a/src/main/java/com/xit/core/support/CamelCaseMap.java +++ b/src/main/java/com/xit/core/support/CamelCaseMap.java @@ -1,6 +1,5 @@ package com.xit.core.support; -import org.springframework.jdbc.support.JdbcUtils; import java.util.HashMap; @@ -9,7 +8,8 @@ public class CamelCaseMap extends HashMap { @Override public Object put(Object key, Object value){ - if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); - else return super.put(key, value); + //if(key != null && key.toString().contains("_")) return super.put(JdbcUtils.convertUnderscoreNameToPropertyName((String)key), value); + //else return super.put(key, value); + return super.put(key, value); } } diff --git a/src/main/java/com/xit/core/support/jpa/AbstractJpaCrudService.java b/src/main/java/com/xit/core/support/jpa/AbstractJpaCrudService.java index d5a9919..0f161db 100644 --- a/src/main/java/com/xit/core/support/jpa/AbstractJpaCrudService.java +++ b/src/main/java/com/xit/core/support/jpa/AbstractJpaCrudService.java @@ -10,61 +10,61 @@ import java.io.Serializable; import java.util.List; import java.util.Optional; -//@Transactional(value = "jpaTransactionManager") +////@Transactional(value = "jpaTransactionManager") public abstract class AbstractJpaCrudService implements IJpaOperation { protected abstract CrudRepository getRepository(); @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public T findOne(final ID id) { return getRepository().findById(id).orElse(null); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Optional findById(final ID id) { return getRepository().findById(id); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findAll() { return Lists.newArrayList(getRepository().findAll()); } @Override - @Transactional + //@Transactional public T save(final T entity) { return getRepository().save(entity); } @Override - @Transactional + //@Transactional public T update(final T entity) { return getRepository().save(entity); } @Override - @Transactional + //@Transactional public void delete(final T entity) { getRepository().delete(entity); } @Override - @Transactional + //@Transactional public void deleteById(final ID id) { getRepository().deleteById(id); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findAll(final Pageable pageable) { return null; } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findPaginated(final int page, final int size) { return null; } diff --git a/src/main/java/com/xit/core/support/jpa/AbstractJpaService.java b/src/main/java/com/xit/core/support/jpa/AbstractJpaService.java index f0ec578..4858bb9 100644 --- a/src/main/java/com/xit/core/support/jpa/AbstractJpaService.java +++ b/src/main/java/com/xit/core/support/jpa/AbstractJpaService.java @@ -11,37 +11,37 @@ import java.io.Serializable; import java.util.List; import java.util.Optional; -//@Transactional(value = "jpaTransactionManager") +////@Transactional(value = "jpaTransactionManager") public abstract class AbstractJpaService implements IJpaOperation { protected abstract PagingAndSortingRepository getRepository(); // Paging - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findAll(final Pageable pageable) { return getRepository().findAll(pageable); } // Paging - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Page findPaginated(final int page, final int size) { return getRepository().findAll(PageRequest.of(page, size)); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public T findOne(final ID id) { return getRepository().findById(id).orElse(null); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public Optional findById(final ID id) { return getRepository().findById(id); } @Override - @Transactional(readOnly = true) + //@Transactional(readOnly = true) public List findAll() { return Lists.newArrayList(getRepository().findAll()); } @@ -50,25 +50,25 @@ public abstract class AbstractJpaService implements // write @Override - @Transactional + //@Transactional public T save(final T entity) { return getRepository().save(entity); } @Override - @Transactional + //@Transactional public T update(final T entity) { return getRepository().save(entity); } @Override - @Transactional + //@Transactional public void delete(final T entity) { getRepository().delete(entity); } @Override - @Transactional + //@Transactional public void deleteById(final ID id) { getRepository().deleteById(id); } diff --git a/src/main/java/com/xit/core/support/jpa/AuditEntity.java b/src/main/java/com/xit/core/support/jpa/AuditEntity.java index 1ecdfbd..75f6e18 100644 --- a/src/main/java/com/xit/core/support/jpa/AuditEntity.java +++ b/src/main/java/com/xit/core/support/jpa/AuditEntity.java @@ -3,14 +3,11 @@ package com.xit.core.support.jpa; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; -import org.hibernate.annotations.ColumnDefault; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; -import org.springframework.data.jpa.domain.support.AuditingEntityListener; -import javax.persistence.*; import java.io.Serializable; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -21,56 +18,39 @@ import java.time.format.DateTimeFormatter; * @see com.xit.core.support.jpa.AuditorAwareConfig */ @Schema(name = "AuditEntity", description = "감사 필드 정의") -@EntityListeners(AuditingEntityListener.class) @Getter // JPA Entity 클래스들이 해당 클래스를 상속할 경우 정의한 필드 적용 -@MappedSuperclass public class AuditEntity implements Serializable { private static final long serialVersionUID = 1146360965411496820L; @Setter @Schema(description = "생성시 생성자 자동 할당", example = " ") @CreatedBy - @Column(name = "created_by", updatable = false, length = 64) private String createdBy; @Setter @Schema(description = "변경시 변경자 자동 할당", example = " ") @LastModifiedBy - @Column(name = "modified_by", length = 64, insertable = false) private String modifiedBy; @Setter @Schema(description = "생성시 생성일시 자동 할당", example = " ") @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; @Setter @Schema(description = "변경시 변경일시 자동 할당", example = " ") @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; @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"; - @PrePersist public void onPrePersist(){ this.createdBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); this.modifiedBy = this.createdBy; } - @PreUpdate public void onPreUpdate(){ this.modifiedBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); } diff --git a/src/main/java/com/xit/core/support/jpa/ISimpleRepository.java b/src/main/java/com/xit/core/support/jpa/ISimpleRepository.java deleted file mode 100644 index c6cad1e..0000000 --- a/src/main/java/com/xit/core/support/jpa/ISimpleRepository.java +++ /dev/null @@ -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 extends JpaRepository { //Repository { - boolean contains(T entity); -} diff --git a/src/main/java/com/xit/core/support/jpa/JpaUtil.java b/src/main/java/com/xit/core/support/jpa/JpaUtil.java index ba6ac0f..201f7e4 100644 --- a/src/main/java/com/xit/core/support/jpa/JpaUtil.java +++ b/src/main/java/com/xit/core/support/jpa/JpaUtil.java @@ -4,7 +4,6 @@ import com.xit.core.util.Checks; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; -import org.springframework.data.jpa.repository.JpaRepository; import java.util.Objects; @@ -25,26 +24,4 @@ public class JpaUtil { // if(Checks.isEmpty(sort)) return PageRequest.of(limit*(page-1), limit); // 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); - } } diff --git a/src/main/java/com/xit/core/support/jpa/SimpleBaseRepository.java b/src/main/java/com/xit/core/support/jpa/SimpleBaseRepository.java deleted file mode 100644 index 8927b00..0000000 --- a/src/main/java/com/xit/core/support/jpa/SimpleBaseRepository.java +++ /dev/null @@ -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 - * @param - */ -//public class SimpleBaseRepository extends QuerydslJpaRepository implements ISimpleRepository{ -public class SimpleBaseRepository extends SimpleJpaRepository implements ISimpleRepository{ - - private final EntityManager em; - - public SimpleBaseRepository(JpaEntityInformation entityInformation, EntityManager em) { - super(entityInformation, em); - this.em = em; - } - - - @Override - public boolean contains(T entity) { - return em.contains(entity); - } -} diff --git a/src/main/java/com/xit/core/util/AwsFileUtil.java b/src/main/java/com/xit/core/util/AwsFileUtil.java index 5f421b4..71fdd26 100644 --- a/src/main/java/com/xit/core/util/AwsFileUtil.java +++ b/src/main/java/com/xit/core/util/AwsFileUtil.java @@ -207,16 +207,16 @@ public class AwsFileUtil { if (userAgent.contains("MSIE 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")) { // MS IE (보통은 6.x 이상 가정) - return URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "\\ "); + return URLEncoder.encode(fileName, "utf-8").replaceAll("\\+", "\\ "); } else if (userAgent.contains("Trident")) { // MS IE 11 - return URLEncoder.encode(fileName, StandardCharsets.UTF_8).replaceAll("\\+", "\\ "); + return URLEncoder.encode(fileName, "utf-8").replaceAll("\\+", "\\ "); } else { // 모질라나 오페라 - return new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1); + return new String(fileName.getBytes("utf-8"), StandardCharsets.ISO_8859_1); } } diff --git a/src/main/java/com/xit/core/util/CommUtil.java b/src/main/java/com/xit/core/util/CommUtil.java index 0b89b36..15628fc 100644 --- a/src/main/java/com/xit/core/util/CommUtil.java +++ b/src/main/java/com/xit/core/util/CommUtil.java @@ -585,7 +585,7 @@ public class CommUtil { String encodedFilename = ""; try { - String encodedFilename1 = "\"" + new String(filename.getBytes(StandardCharsets.UTF_8), "8859_1") + "\""; + String encodedFilename1 = "\"" + new String(filename.getBytes("utf-8"), "8859_1") + "\""; switch (browser) { case "Firefox": @@ -597,7 +597,7 @@ public class CommUtil { for (int i = 0; i < filename.length(); i++) { char c = filename.charAt(i); if (c > '~') { - sb.append(URLEncoder.encode("" + c, StandardCharsets.UTF_8)); + sb.append(URLEncoder.encode("" + c, "utf-8")); } else { sb.append(c); } @@ -605,7 +605,7 @@ public class CommUtil { encodedFilename = sb.toString(); break; default: - encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); // MSIE 외 모든 브라우저 + encodedFilename = URLEncoder.encode(filename, "utf-8").replaceAll("\\+", "%20"); // MSIE 외 모든 브라우저 break; } diff --git a/src/main/java/com/xit/core/util/ConvertUtils.java b/src/main/java/com/xit/core/util/ConvertUtils.java index 10ec672..2d1dced 100644 --- a/src/main/java/com/xit/core/util/ConvertUtils.java +++ b/src/main/java/com/xit/core/util/ConvertUtils.java @@ -49,9 +49,9 @@ public class ConvertUtils { return java.util.Date.from(instant); } - public static LocalDate toLocalDateFromDate(java.util.Date date){ - return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); - } +// public static LocalDate toLocalDateFromDate(java.util.Date date){ +// return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); +// } public static LocalDateTime toLocalDateTimeFromDate(java.util.Date date){ return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); diff --git a/src/main/java/com/xit/core/util/DateUtil.java b/src/main/java/com/xit/core/util/DateUtil.java index 81e6f1d..81622e8 100644 --- a/src/main/java/com/xit/core/util/DateUtil.java +++ b/src/main/java/com/xit/core/util/DateUtil.java @@ -32,10 +32,10 @@ public class DateUtil { //return java.sql.Timestamp.valueOf(localDateTime); } - public static LocalDate toLocalDateFromDate(Date date){ - return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); - //return new java.sql.Date(date.getTime()).toLocalDate(); - } +// public static LocalDate toLocalDateFromDate(Date date){ +// return LocalDate.ofInstant(date.toInstant(), ZoneId.systemDefault()); +// //return new java.sql.Date(date.getTime()).toLocalDate(); +// } public static LocalDateTime toLocalDateTimeFromDate(Date date){ return LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); diff --git a/src/main/java/com/xit/core/util/PoiExcelView.java b/src/main/java/com/xit/core/util/PoiExcelView.java index 71dc4b4..341c153 100644 --- a/src/main/java/com/xit/core/util/PoiExcelView.java +++ b/src/main/java/com/xit/core/util/PoiExcelView.java @@ -51,10 +51,10 @@ public class PoiExcelView extends AbstractXlsxView { encodedFilename = filename; }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 { - 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)) { encodedFilename = encodedFilename1; @@ -66,7 +66,7 @@ public class PoiExcelView extends AbstractXlsxView { for (int i = 0; i < filename.length(); i++) { char c = filename.charAt(i); if (c > '~') { - sb.append(URLEncoder.encode("" + c, StandardCharsets.UTF_8)); + sb.append(URLEncoder.encode("" + c, "utf-8")); } else { sb.append(c); }