@ -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<Map<St
private final cokr . xit . ens . modules . common . ctgy . intgrnnoti . domain . repository . TmpltMngKkoAlimtalkMapper tmpltMngKkoAlimtalkMapper ;
private final cokr . xit . ens . modules . common . ctgy . intgrnnoti . domain . repository . TmpltMngKkoMydocMapper tmpltMngKkoMydocMapper ;
private final cokr . xit . ens . modules . common . ctgy . intgrnnoti . domain . repository . TmpltMngNvSigntalkMapper tmpltMngNvSigntalkMapper ;
private final cokr . xit . ens . modules . common . ctgy . intgrnnoti . domain . repository . TmpltMngKtSigntalkMapper tmpltMngKtSigntalkMapper ;
private final cokr . xit . ens . modules . common . ctgy . intgrnnoti . domain . repository . TmpltMngKtGibisMapper tmpltMngKtGibisMapper ;
private final RedisTemplate redisTemplate ;
// private final RedisTemplate redisTemplate;
private TmpltMngIntgrnMapper intgrnMapper = Mappers . getMapper ( TmpltMngIntgrnMapper . class ) ;
@ -60,12 +54,11 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
@Override
public Optional < TmpltMngIntgrnDTO > find ( String orgCd , String tmpltCd ) {
// return tmpltMngIntgrnRepository.findDtoByOrgCdAndTmpltCd(orgCd, tmpltCd);
return tmpltMngIntgrnRepository . findDtoByOrgCdAndTmpltCd ( orgCd , tmpltCd ) ;
String key = super . pushCache ( redisTemplate , orgCd , tmpltCd , tmpltMngIntgrnRepository ) ;
HashOperations < String , String , TmpltMngIntgrnDTO > hashOperations = redisTemplate . opsForHash ( ) ;
return Optional . ofNullable ( hashOperations . entries ( KEY ) . get ( key ) ) ;
// String key = super.pushCache(redisTemplate, orgCd, tmpltCd, tmpltMngIntgrnRepository);
// HashOperations<String, String, TmpltMngIntgrnDTO> hashOperations = redisTemplate.opsForHash();
// return Optional.ofNullable(hashOperations.entries(KEY).get(key));
}
@Override
@ -84,10 +77,6 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
this . toMappedChildTmpltMng ( dto , dto . getKkoMydoc ( ) ) ;
if ( ! CmmnUtil . isEmpty ( dto . getNvSigntalk ( ) ) )
this . toMappedChildTmpltMng ( dto , dto . getNvSigntalk ( ) ) ;
if ( ! CmmnUtil . isEmpty ( dto . getKtSigntalk ( ) ) )
this . toMappedChildTmpltMng ( dto , dto . getKtSigntalk ( ) ) ;
if ( ! CmmnUtil . isEmpty ( dto . getKtGibis ( ) ) )
this . toMappedChildTmpltMng ( dto , dto . getKtGibis ( ) ) ;
final Validator validator = Validation . buildDefaultValidatorFactory ( ) . getValidator ( ) ;
Set < ConstraintViolation < TmpltMngIntgrnDTO > > list = validator . validate ( dto ) ;
@ -136,16 +125,6 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
TmpltMngNvSigntalk tmpltChild = mapper . toEntity ( dto . getNvSigntalk ( ) ) ;
tmpltMngNvSigntalkMapper . add ( tmpltChild ) ;
}
if ( ! CmmnUtil . isEmpty ( dto . getKtSigntalk ( ) ) ) {
TmpltMngKtSigntalkMapper mapper = Mappers . getMapper ( TmpltMngKtSigntalkMapper . class ) ;
TmpltMngKtSigntalk tmpltChild = mapper . toEntity ( dto . getKtSigntalk ( ) ) ;
tmpltMngKtSigntalkMapper . add ( tmpltChild ) ;
}
if ( ! CmmnUtil . isEmpty ( dto . getKtGibis ( ) ) ) {
TmpltMngKtGibisMapper mapper = Mappers . getMapper ( TmpltMngKtGibisMapper . class ) ;
TmpltMngKtGibis tmpltChild = mapper . toEntity ( dto . getKtGibis ( ) ) ;
tmpltMngKtGibisMapper . add ( tmpltChild ) ;
}
}
@ -154,12 +133,10 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
protected void modifyProc ( TmpltMngIntgrnDTO dto ) {
TmpltMngIntgrn tmpltMng = tmpltMngIntgrnRepository . findFetchByOrgCdAndTmpltCd ( dto . getOrgCd ( ) , dto . getTmpltCd ( ) )
. orElseThrow ( ( ) - > 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<Map<St
tmpltMngKkoAlimtalkMapper . add ( tmpltChild ) ;
}
}
if ( ! CmmnUtil . isEmpty ( dto . getKkoMydoc ( ) ) ) {
TmpltMngKkoMydocMapper mapper = Mappers . getMapper ( TmpltMngKkoMydocMapper . class ) ;
TmpltMngKkoMydoc tmpltChild = mapper . toEntity ( dto . getKkoMydoc ( ) ) ;
@ -183,7 +160,7 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
tmpltMngKkoMydocMapper . add ( tmpltChild ) ;
}
}
if ( ! CmmnUtil . isEmpty ( dto . getNvSigntalk ( ) ) ) {
TmpltMngNvSigntalkMapper mapper = Mappers . getMapper ( TmpltMngNvSigntalkMapper . class ) ;
TmpltMngNvSigntalk tmpltChild = mapper . toEntity ( dto . getNvSigntalk ( ) ) ;
@ -195,33 +172,8 @@ public class TmpltMngStrategyIntegration extends TmpltMngStrategyTemplate<Map<St
tmpltMngNvSigntalkMapper . add ( tmpltChild ) ;
}
}
if ( ! CmmnUtil . isEmpty ( dto . getKtSigntalk ( ) ) ) {
TmpltMngKtSigntalkMapper mapper = Mappers . getMapper ( TmpltMngKtSigntalkMapper . class ) ;
TmpltMngKtSigntalk tmpltChild = mapper . toEntity ( dto . getKtSigntalk ( ) ) ;
if ( tmpltMngKtSigntalkMapper . findById ( TmpltMngIds . builder ( ) . orgMng ( dto . getOrgCd ( ) ) . tmpltCd ( dto . getTmpltCd ( ) ) . build ( ) ) . isPresent ( ) ) {
tmpltChild . setUpdId ( "ENS_SYS" ) ;
tmpltMngKtSigntalkMapper . modify ( tmpltChild ) ;
} else {
tmpltChild . setRegistId ( "ENS_SYS" ) ;
tmpltMngKtSigntalkMapper . add ( tmpltChild ) ;
}
}
if ( ! CmmnUtil . isEmpty ( dto . getKtGibis ( ) ) ) {
TmpltMngKtGibisMapper mapper = Mappers . getMapper ( TmpltMngKtGibisMapper . class ) ;
TmpltMngKtGibis tmpltChild = mapper . toEntity ( dto . getKtGibis ( ) ) ;
if ( tmpltMngKtGibisMapper . findById ( TmpltMngIds . builder ( ) . orgMng ( dto . getOrgCd ( ) ) . tmpltCd ( dto . getTmpltCd ( ) ) . build ( ) ) . isPresent ( ) ) {
tmpltChild . setUpdId ( "ENS_SYS" ) ;
tmpltMngKtGibisMapper . modify ( tmpltChild ) ;
} else {
tmpltChild . setRegistId ( "ENS_SYS" ) ;
tmpltMngKtGibisMapper . add ( tmpltChild ) ;
}
}
super . deleteCache ( redisTemplate , dto . getOrgCd ( ) , dto . getTmpltCd ( ) ) ;
// super.deleteCache(redisTemplate, dto.getOrgCd(), dto.getTmpltCd());
}
private void toMappedChildTmpltMng ( TmpltMngIntgrnDTO dto , TmpltMngDTO childDto ) {