redis config 수정, 포맷팅
This commit is contained in:
@@ -81,7 +81,7 @@ public class CommonCodeUtil {
|
|||||||
* 상위 코드와 하위 코드로 공통코드명 조회
|
* 상위 코드와 하위 코드로 공통코드명 조회
|
||||||
*
|
*
|
||||||
* @param parentCode 상위 코드
|
* @param parentCode 상위 코드
|
||||||
* @param childCode 하위 코드
|
* @param childCode 하위 코드
|
||||||
* @return 공통코드명
|
* @return 공통코드명
|
||||||
*/
|
*/
|
||||||
public Optional<String> getCodeName(String parentCode, String childCode) {
|
public Optional<String> getCodeName(String parentCode, String childCode) {
|
||||||
@@ -113,10 +113,10 @@ public class CommonCodeUtil {
|
|||||||
try {
|
try {
|
||||||
List<Basic> allCodes = commonCodeService.getFindAll();
|
List<Basic> allCodes = commonCodeService.getFindAll();
|
||||||
return allCodes.stream()
|
return allCodes.stream()
|
||||||
.filter(code -> parentCode.equals(code.getCode()))
|
.filter(code -> parentCode.equals(code.getCode()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(Basic::getChildren)
|
.map(Basic::getChildren)
|
||||||
.orElse(List.of());
|
.orElse(List.of());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("상위 코드 기반 하위 코드 조회 중 오류 발생: {}", parentCode, e);
|
log.error("상위 코드 기반 하위 코드 조회 중 오류 발생: {}", parentCode, e);
|
||||||
return List.of();
|
return List.of();
|
||||||
@@ -127,7 +127,7 @@ public class CommonCodeUtil {
|
|||||||
* 코드 사용 가능 여부 확인
|
* 코드 사용 가능 여부 확인
|
||||||
*
|
*
|
||||||
* @param parentId 상위 코드 ID
|
* @param parentId 상위 코드 ID
|
||||||
* @param code 확인할 코드값
|
* @param code 확인할 코드값
|
||||||
* @return 사용 가능 여부 (true: 사용 가능, false: 중복 또는 오류)
|
* @return 사용 가능 여부 (true: 사용 가능, false: 중복 또는 오류)
|
||||||
*/
|
*/
|
||||||
public boolean isCodeAvailable(Long parentId, String code) {
|
public boolean isCodeAvailable(Long parentId, String code) {
|
||||||
@@ -140,7 +140,7 @@ public class CommonCodeUtil {
|
|||||||
ApiResponseDto.ResponseObj response = commonCodeService.getCodeCheckDuplicate(parentId, code);
|
ApiResponseDto.ResponseObj response = commonCodeService.getCodeCheckDuplicate(parentId, code);
|
||||||
// ResponseObj의 flag 필드를 통해 SUCCESS/FAIL 확인
|
// ResponseObj의 flag 필드를 통해 SUCCESS/FAIL 확인
|
||||||
return response.getFlag() != null
|
return response.getFlag() != null
|
||||||
&& response.getFlag().equals(ApiResponseDto.SuccFailCode.SUCCESS);
|
&& response.getFlag().equals(ApiResponseDto.SuccFailCode.SUCCESS);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("코드 중복 확인 중 오류 발생: parentId={}, code={}", parentId, code, e);
|
log.error("코드 중복 확인 중 오류 발생: parentId={}, code={}", parentId, code, e);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -42,9 +42,7 @@ public class RedisConfig {
|
|||||||
return new LettuceConnectionFactory(redisConfig);
|
return new LettuceConnectionFactory(redisConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Redis에서 사용할 공통 ObjectMapper */
|
||||||
* Redis에서 사용할 공통 ObjectMapper
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public ObjectMapper redisObjectMapper() {
|
public ObjectMapper redisObjectMapper() {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
@@ -56,9 +54,7 @@ public class RedisConfig {
|
|||||||
return objectMapper;
|
return objectMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 공통 Serializer (Template + Cache 둘 다 이거 사용) */
|
||||||
* 공통 Serializer (Template + Cache 둘 다 이거 사용)
|
|
||||||
*/
|
|
||||||
@Bean
|
@Bean
|
||||||
public GenericJackson2JsonRedisSerializer redisSerializer(ObjectMapper redisObjectMapper) {
|
public GenericJackson2JsonRedisSerializer redisSerializer(ObjectMapper redisObjectMapper) {
|
||||||
return new GenericJackson2JsonRedisSerializer(redisObjectMapper);
|
return new GenericJackson2JsonRedisSerializer(redisObjectMapper);
|
||||||
@@ -66,8 +62,8 @@ public class RedisConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate(
|
public RedisTemplate<String, Object> redisTemplate(
|
||||||
RedisConnectionFactory connectionFactory,
|
RedisConnectionFactory connectionFactory,
|
||||||
GenericJackson2JsonRedisSerializer redisSerializer) {
|
GenericJackson2JsonRedisSerializer redisSerializer) {
|
||||||
|
|
||||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||||
template.setConnectionFactory(connectionFactory);
|
template.setConnectionFactory(connectionFactory);
|
||||||
@@ -84,17 +80,17 @@ public class RedisConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CacheManager cacheManager(
|
public CacheManager cacheManager(
|
||||||
RedisConnectionFactory connectionFactory,
|
RedisConnectionFactory connectionFactory,
|
||||||
GenericJackson2JsonRedisSerializer redisSerializer) {
|
GenericJackson2JsonRedisSerializer redisSerializer) {
|
||||||
|
|
||||||
RedisCacheConfiguration config =
|
RedisCacheConfiguration config =
|
||||||
RedisCacheConfiguration.defaultCacheConfig()
|
RedisCacheConfiguration.defaultCacheConfig()
|
||||||
.entryTtl(Duration.ofHours(1)) // 기본 TTL 1시간
|
.entryTtl(Duration.ofHours(1)) // 기본 TTL 1시간
|
||||||
.serializeKeysWith(
|
.serializeKeysWith(
|
||||||
RedisSerializationContext.SerializationPair.fromSerializer(
|
RedisSerializationContext.SerializationPair.fromSerializer(
|
||||||
new StringRedisSerializer()))
|
new StringRedisSerializer()))
|
||||||
.serializeValuesWith(
|
.serializeValuesWith(
|
||||||
RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer));
|
RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer));
|
||||||
|
|
||||||
return RedisCacheManager.builder(connectionFactory).cacheDefaults(config).build();
|
return RedisCacheManager.builder(connectionFactory).cacheDefaults(config).build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public class MembersService {
|
|||||||
|
|
||||||
// salt 생성, 사번이 salt
|
// salt 생성, 사번이 salt
|
||||||
String salt =
|
String salt =
|
||||||
BCryptSaltGenerator.generateSaltWithEmployeeNo(updateReq.getEmployeeNo().trim());
|
BCryptSaltGenerator.generateSaltWithEmployeeNo(updateReq.getEmployeeNo().trim());
|
||||||
|
|
||||||
// 패스워드 암호화, 초기 패스워드 고정
|
// 패스워드 암호화, 초기 패스워드 고정
|
||||||
String hashedPassword = BCrypt.hashpw(updateReq.getPassword(), salt);
|
String hashedPassword = BCrypt.hashpw(updateReq.getPassword(), salt);
|
||||||
|
|||||||
Reference in New Issue
Block a user