From 8b94181caf2263bdb7e215439af25f0dbbc52dea Mon Sep 17 00:00:00 2001 From: minkyu1128 Date: Thu, 30 Mar 2023 13:10:48 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AF=BC=EC=9E=90=EA=B3=A0=EC=86=8D?= =?UTF-8?q?=EB=8F=84=EB=A1=9C=20=EC=9A=B4=EC=98=81=EA=B3=84=20=EB=B0=B0?= =?UTF-8?q?=ED=8F=AC=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/redis/EmbeddedRedisConfig.java | 2 +- .../core/config/redis/RedisCacheConfig.java | 4 +- .../strategy/TmpltMngStrategyIntegration.java | 66 +++---------------- .../ctgy/sys/mng/service/OrgMngService.java | 6 +- .../ctgy/sys/mng/service/TmpltMngService.java | 6 +- .../strategy/TmpltMngStrategyBasic.java | 24 +++---- .../strategy/TmpltMngStrategyKkoAlimtalk.java | 14 ++-- .../strategy/TmpltMngStrategyKkoMydoc.java | 14 ++-- .../strategy/TmpltMngStrategyNvSigntalk.java | 14 ++-- 9 files changed, 45 insertions(+), 105 deletions(-) diff --git a/src/main/java/cokr/xit/ens/core/config/redis/EmbeddedRedisConfig.java b/src/main/java/cokr/xit/ens/core/config/redis/EmbeddedRedisConfig.java index 578bc64..3b7bfb5 100644 --- a/src/main/java/cokr/xit/ens/core/config/redis/EmbeddedRedisConfig.java +++ b/src/main/java/cokr/xit/ens/core/config/redis/EmbeddedRedisConfig.java @@ -10,7 +10,7 @@ import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @Slf4j -@Configuration +//@Configuration public class EmbeddedRedisConfig { @Value("${spring.redis.port}") diff --git a/src/main/java/cokr/xit/ens/core/config/redis/RedisCacheConfig.java b/src/main/java/cokr/xit/ens/core/config/redis/RedisCacheConfig.java index 797c4f2..09c401e 100644 --- a/src/main/java/cokr/xit/ens/core/config/redis/RedisCacheConfig.java +++ b/src/main/java/cokr/xit/ens/core/config/redis/RedisCacheConfig.java @@ -57,7 +57,7 @@ public class RedisCacheConfig { @Bean public CacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory) { RedisCacheConfiguration redisCacheConfiguration = redisCacheDefaultConfiguration() - .entryTtl(Duration.ofSeconds(CacheKey.DEFAULT_EXP_SEC)) + .entryTtl(Duration.ofSeconds(CacheKey.DEFAULT_EXP_SEC)) // .computePrefixWith(CacheKeyPrefix.simple()) ; @@ -65,7 +65,7 @@ public class RedisCacheConfig { return RedisCacheManager.RedisCacheManagerBuilder .fromConnectionFactory(redisConnectionFactory) .cacheDefaults(redisCacheConfiguration) - .withInitialCacheConfigurations(redisCacheConfigurationMap()) + .withInitialCacheConfigurations(redisCacheConfigurationMap()) .build(); } diff --git a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/strategy/TmpltMngStrategyIntegration.java b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/strategy/TmpltMngStrategyIntegration.java index a8a1ab7..c429920 100644 --- a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/strategy/TmpltMngStrategyIntegration.java +++ b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/strategy/TmpltMngStrategyIntegration.java @@ -18,10 +18,6 @@ import cokr.xit.ens.modules.kkoalimtalk.domain.TmpltMngKkoAlimtalk; import cokr.xit.ens.modules.kkoalimtalk.model.struct.TmpltMngKkoAlimtalkMapper; import cokr.xit.ens.modules.kkomydoc.domain.TmpltMngKkoMydoc; import cokr.xit.ens.modules.kkomydoc.model.struct.TmpltMngKkoMydocMapper; -import cokr.xit.ens.modules.ktsigntalk.direct.domain.TmpltMngKtSigntalk; -import cokr.xit.ens.modules.ktsigntalk.direct.model.struct.TmpltMngKtSigntalkMapper; -import cokr.xit.ens.modules.ktsigntalk.gibis.domain.TmpltMngKtGibis; -import cokr.xit.ens.modules.ktsigntalk.gibis.model.struct.TmpltMngKtGibisMapper; import cokr.xit.ens.modules.nvsigntalk.domain.TmpltMngNvSigntalk; import cokr.xit.ens.modules.nvsigntalk.model.struct.TmpltMngNvSigntalkMapper; import com.fasterxml.jackson.core.JsonProcessingException; @@ -47,9 +43,7 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate find(String orgCd, String tmpltCd) { -// return tmpltMngIntgrnRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); + return tmpltMngIntgrnRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); - - String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngIntgrnRepository); - HashOperations hashOperations = redisTemplate.opsForHash(); - return Optional.ofNullable(hashOperations.entries(KEY).get(key)); +// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngIntgrnRepository); +// HashOperations hashOperations = redisTemplate.opsForHash(); +// return Optional.ofNullable(hashOperations.entries(KEY).get(key)); } @Override @@ -84,10 +77,6 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate> list = validator.validate(dto); @@ -136,16 +125,6 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate new EnsException(EnsErrCd.ERR404, String.format("기관코드(%s) 및 템플릿코드(%s)가 일치하는 자료가 없습니다.", dto.getOrgCd(), dto.getTmpltCd()))); - if (!"Y".equals(tmpltMng.getUseYn())) - throw new EnsException(EnsErrCd.ERR402, "\"미사용\" 상태의 템플릿은 수정 할 수 없습니다."); intgrnMapper.updateFromDto(dto, tmpltMng); tmpltMng.setUpdId("ENS_SYS"); - + if (!CmmnUtil.isEmpty(dto.getKkoAlimtalk())) { TmpltMngKkoAlimtalkMapper mapper = Mappers.getMapper(TmpltMngKkoAlimtalkMapper.class); TmpltMngKkoAlimtalk tmpltChild = mapper.toEntity(dto.getKkoAlimtalk()); @@ -171,7 +148,7 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate find(String orgCd) { try { return EnsResponseVO.okBuilder() @@ -129,7 +129,7 @@ public class OrgMngService { } - @CachePut(value = CacheKey.ORGMNG, key = "#dto.orgCd") +// @CachePut(value = CacheKey.ORGMNG, key = "#dto.orgCd") public EnsResponseVO modify(OrgMngDTO dto) { try { final Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); @@ -193,7 +193,7 @@ public class OrgMngService { } } - @CacheEvict(value = CacheKey.ORGMNG, key = "#orgCd") +// @CacheEvict(value = CacheKey.ORGMNG, key = "#orgCd") public EnsResponseVO delete(String orgCd) { try { OrgMng orgMng = orgMngRepository.findById(orgCd).orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("기관코드(%s)와 일치하는 자료가 없습니다.", orgCd))); diff --git a/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/TmpltMngService.java b/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/TmpltMngService.java index e0ae760..052402a 100644 --- a/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/TmpltMngService.java +++ b/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/TmpltMngService.java @@ -29,7 +29,7 @@ public class TmpltMngService extends TmpltMngCacheSupport { private final TmpltMngRepository tmpltMngRepository; private final Map mTmpltMngStrategy; - private final RedisTemplate redisTemplate; +// private final RedisTemplate redisTemplate; public EnsResponseVO> findAllBySearchDTO(TmpltMngSearchDTO searchDTO, String dType) { TmpltMngStrategy tmpltMngStrategy = mTmpltMngStrategy.get("tmpltMngStrategy_" + dType); @@ -126,8 +126,8 @@ public class TmpltMngService extends TmpltMngCacheSupport { .errMsg(e.getMessage()) .build(); } finally { - - super.deleteCache(redisTemplate, orgCd, tmpltCd); +// +// super.deleteCache(redisTemplate, orgCd, tmpltCd); } } diff --git a/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/strategy/TmpltMngStrategyBasic.java b/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/strategy/TmpltMngStrategyBasic.java index 67aec0a..7236ec7 100644 --- a/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/strategy/TmpltMngStrategyBasic.java +++ b/src/main/java/cokr/xit/ens/modules/common/ctgy/sys/mng/service/strategy/TmpltMngStrategyBasic.java @@ -11,8 +11,6 @@ import cokr.xit.ens.modules.common.ctgy.sys.mng.model.TmpltMngSearchDTO; import cokr.xit.ens.modules.common.ctgy.sys.mng.model.struct.TmpltMngMapper; import lombok.RequiredArgsConstructor; import org.mapstruct.factory.Mappers; -import org.springframework.data.redis.core.HashOperations; -import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import javax.validation.ConstraintViolation; @@ -26,8 +24,8 @@ import java.util.stream.Collectors; public class TmpltMngStrategyBasic extends TmpltMngStrategyTemplate, TmpltMngDTO> { private final OrgMngRepository orgMngRepository; private final TmpltMngRepository tmpltMngRepository; - private TmpltMngMapper tmpltMngMapper = Mappers.getMapper(TmpltMngMapper.class); - private final RedisTemplate redisTemplate; + private TmpltMngMapper kkoMydocMapper = Mappers.getMapper(TmpltMngMapper.class); +// private final RedisTemplate redisTemplate; public List findAll(TmpltMngSearchDTO tmpltMngSearchDTO) { return tmpltMngRepository.findAllDtoBySearchDTO(tmpltMngSearchDTO); @@ -35,12 +33,11 @@ public class TmpltMngStrategyBasic extends TmpltMngStrategyTemplate find(String orgCd, String tmpltCd) { -// return tmpltMngRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); + return tmpltMngRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); - - String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngRepository); - HashOperations hashOperations = redisTemplate.opsForHash(); - return Optional.ofNullable(hashOperations.entries(KEY).get(key)); +// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngRepository); +// HashOperations hashOperations = redisTemplate.opsForHash(); +// return Optional.ofNullable(hashOperations.entries(KEY).get(key)); } @Override @@ -70,7 +67,7 @@ public class TmpltMngStrategyBasic extends TmpltMngStrategyTemplate new EnsException(EnsErrCd.ERR404, String.format("기관코드(%s) 및 템플릿코드(%s)가 일치하는 자료가 없습니다.", tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd()))); - if(!"Y".equals(tmpltMng.getUseYn())) - throw new EnsException(EnsErrCd.ERR402, "\"미사용\" 상태의 템플릿은 수정 할 수 없습니다."); - tmpltMngMapper.updateFromDto(tmpltMngDTO, tmpltMng); + kkoMydocMapper.updateFromDto(tmpltMngDTO, tmpltMng); tmpltMng.setUpdId("ENS_SYS"); - - super.deleteCache(redisTemplate, tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd()); +// super.deleteCache(redisTemplate, tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd()); } } diff --git a/src/main/java/cokr/xit/ens/modules/kkoalimtalk/service/strategy/TmpltMngStrategyKkoAlimtalk.java b/src/main/java/cokr/xit/ens/modules/kkoalimtalk/service/strategy/TmpltMngStrategyKkoAlimtalk.java index 2ede96d..9574b72 100644 --- a/src/main/java/cokr/xit/ens/modules/kkoalimtalk/service/strategy/TmpltMngStrategyKkoAlimtalk.java +++ b/src/main/java/cokr/xit/ens/modules/kkoalimtalk/service/strategy/TmpltMngStrategyKkoAlimtalk.java @@ -32,7 +32,7 @@ public class TmpltMngStrategyKkoAlimtalk extends TmpltMngStrategyTemplate findAll(TmpltMngSearchDTO tmpltMngSearchDTO) { @@ -41,12 +41,11 @@ public class TmpltMngStrategyKkoAlimtalk extends TmpltMngStrategyTemplate find(String orgCd, String tmpltCd) { -// return tmpltMngKkoAlimtalkRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); + return tmpltMngKkoAlimtalkRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); - - String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngKkoAlimtalkRepository); - HashOperations hashOperations = redisTemplate.opsForHash(); - return Optional.ofNullable(hashOperations.entries(KEY).get(key)); +// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngKkoAlimtalkRepository); +// HashOperations hashOperations = redisTemplate.opsForHash(); +// return Optional.ofNullable(hashOperations.entries(KEY).get(key)); } @Override @@ -93,7 +92,6 @@ public class TmpltMngStrategyKkoAlimtalk extends TmpltMngStrategyTemplate findAll(TmpltMngSearchDTO tmpltMngSearchDTO) { @@ -41,12 +41,11 @@ public class TmpltMngStrategyKkoMydoc extends TmpltMngStrategyTemplate find(String orgCd, String tmpltCd) { -// return tmpltMngKkoMydocRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); + return tmpltMngKkoMydocRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); - - String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngKkoMydocRepository); - HashOperations hashOperations = redisTemplate.opsForHash(); - return Optional.ofNullable(hashOperations.entries(KEY).get(key)); +// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngKkoMydocRepository); +// HashOperations hashOperations = redisTemplate.opsForHash(); +// return Optional.ofNullable(hashOperations.entries(KEY).get(key)); } @@ -94,7 +93,6 @@ public class TmpltMngStrategyKkoMydoc extends TmpltMngStrategyTemplate findAll(TmpltMngSearchDTO tmpltMngSearchDTO) { @@ -41,12 +41,11 @@ public class TmpltMngStrategyNvSigntalk extends TmpltMngStrategyTemplate find(String orgCd, String tmpltCd) { -// return tmpltMngNvSigntalkRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); + return tmpltMngNvSigntalkRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd); - - String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngNvSigntalkRepository); - HashOperations hashOperations = redisTemplate.opsForHash(); - return Optional.ofNullable(hashOperations.entries(KEY).get(key)); +// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngNvSigntalkRepository); +// HashOperations hashOperations = redisTemplate.opsForHash(); +// return Optional.ofNullable(hashOperations.entries(KEY).get(key)); } @@ -94,7 +93,6 @@ public class TmpltMngStrategyNvSigntalk extends TmpltMngStrategyTemplate