refactor: batch scheduler 제거

main
Jonguk. Lim 2 months ago
parent 0035d31a32
commit d428f0b504

@ -1,70 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.IntgrnNotiService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsIntgrnScheduler {
private final IntgrnNotiService intgrnNotiService;
/**
*
* -. .
*/
@Scheduled(cron = "0 */10 9-18 * * *")
public void resended() {
EnsResponseVO responseVO = intgrnNotiService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 재전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
*
* -. "실패(~fail) 또는 만료(close) 외" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
@Scheduled(cron = "0 0 23 * * *")
public void fetched() {
EnsResponseVO responseVO = intgrnNotiService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
*
* -. "열람(open)" "마감(close)" .
*/
@Scheduled(cron = "30 0 9-18 * * *")
public void closed() {
EnsResponseVO<List<Long>> responseVO = intgrnNotiService.closed();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS INTGRN] 통합고지 마감처리 - 총 {}건")
.append("\nIntSendMastId {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.getResultInfo().size(), responseVO.getResultInfo().toString());
}
}

@ -1,35 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKkoAlimtalkScheduler {
private final KkoAlimtalkService kkoAlimtalkService;
/**
*
* -. "제작성공(makeok)" (sendDt) .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = kkoAlimtalkService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 알림톡 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
}

@ -1,68 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocHisService;
import cokr.xit.ens.modules.kkomydoc.service.KkoMydocService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKkoMydocScheduler {
private final KkoMydocService kkoMydocService;
private final KkoMydocHisService kkoMydocHisService;
/**
* ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = kkoMydocService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = kkoMydocService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
Long totCnt = kkoMydocHisService.truncateStatHist();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 카카오 내문서함(인증톡) 상태변경요청이력 영구 삭제")
.append("\n결과: {} 건 삭제")
.append("\n=======================================================");
log.info(sb.toString(), totCnt);
}
}

@ -1,82 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.core.exception.code.EnsErrCd;
import cokr.xit.ens.modules.ktsigntalk.gibis.service.KtGibisHisService;
import cokr.xit.ens.modules.ktsigntalk.gibis.service.KtGibisService;
import com.querydsl.core.Tuple;
import com.querydsl.jpa.impl.JPAQueryFactory;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
import static cokr.xit.ens.modules.common.ctgy.sys.mng.domain.QOrgMng.orgMng;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKtGibisScheduler {
private final KtGibisService ktGibisService;
private final KtGibisHisService ktGibisHisService;
private final JPAQueryFactory query;
/**
* KT ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = ktGibisService.sendBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡(지비스) 전송처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT ()
*/
@Scheduled(cron = "0 0 0 1 */4 *")
public void refreshAuthToken() {
List<Tuple> list = query.select(orgMng.orgCd, orgMng.ktStClientId, orgMng.ktStClientSecret)
.from(orgMng)
.where(orgMng.ktStAccessToken.isNotNull())
.fetch();
int cntRefresh = list.stream()
.map(tuple -> {
EnsResponseVO<Long> ensResponseVO = ktGibisService.refreshAuthToken(tuple.get(orgMng.orgCd), tuple.get(orgMng.ktStClientId), tuple.get(orgMng.ktStClientSecret));
return EnsErrCd.OK.equals(ensResponseVO.getErrCode()) ? 1 : 0;
})
.reduce(Integer::sum)
.orElse(0);
log.info("=======================================================");
log.info("[ENS] KT 인증톡(지비스) accessToken 갱신");
log.info("결과: {} 건 갱신({}/{})", cntRefresh, cntRefresh, list.size());
log.info("=======================================================");
}
// /**
// * KT 인증톡(지비스) 상태갱신요청이력 영구 삭제
// */
// @Scheduled(cron = "4 4 4 * * *")
// public void deleteStateHis() {
// EnsResponseVO<Long> ensResponseVO = ktGibisHisService.truncateStatHist();
// log.info("=======================================================");
// log.info("[ENS] KT 인증톡(지비스) 상태변경요청이력 영구 삭제");
// log.info("결과: {} 건 삭제", ensResponseVO.getResultInfo());
// log.info("=======================================================");
// }
}

@ -1,63 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.ktsigntalk.direct.service.KtSigntalkHisService;
import cokr.xit.ens.modules.ktsigntalk.direct.service.KtSigntalkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsKtSigntalkScheduler {
private final KtSigntalkService ktSigntalkService;
private final KtSigntalkHisService ktSigntalkHisService;
/**
* KT
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = ktSigntalkService.sendBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 전송처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = ktSigntalkService.statBulkAll();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 문서상태갱신 처리");
log.info("결과: {}", responseVO.toString());
log.info("=======================================================");
}
/**
* KT
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
EnsResponseVO<Long> ensResponseVO = ktSigntalkHisService.truncateStatHist();
log.info("=======================================================");
log.info("[ENS] KT 인증톡 상태변경요청이력 영구 삭제");
log.info("결과: {} 건 삭제", ensResponseVO.getResultInfo());
log.info("=======================================================");
}
}

@ -1,70 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.core.aop.EnsResponseVO;
import cokr.xit.ens.modules.nvsigntalk.service.NvSigntalkHisService;
import cokr.xit.ens.modules.nvsigntalk.service.NvSigntalkService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
@RequiredArgsConstructor
public class EnsNvSigntalkScheduler {
private final NvSigntalkService nvSigntalkService;
private final NvSigntalkHisService nvSigntalkHisService;
/**
* ()
* -. "제작성공(makeok)" .
*/
@Scheduled(cron = "0 */1 9-18 * * *")
public void sended() {
EnsResponseVO responseVO = nvSigntalkService.sendBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 전송처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
* -. "발송성공/발송완료/열람중(sendok/sendcmplt/open)" .
* -. "전송완료(sendcmplt) 또는 열람중(open)" .
*/
// @Scheduled(cron = "0 */5 9-18 * * *")
@Scheduled(cron = "0 */30 9-18 * * *")
public void fetched() {
EnsResponseVO responseVO = nvSigntalkService.statBulkAll();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 문서상태갱신 처리")
.append("\n결과: {}")
.append("\n=======================================================");
log.info(sb.toString(), responseVO.toString());
}
/**
* ()
*/
@Scheduled(cron = "4 4 4 * * *")
public void deleteStateHis() {
Long totCnt = nvSigntalkHisService.truncateStatHist();
StringBuffer sb = new StringBuffer();
sb.append("\n=======================================================")
.append("\n[ENS] 네이버 고지서(인증톡) 상태변경요청이력 영구 삭제")
.append("\n결과: {} 건 삭제")
.append("\n=======================================================");
log.info(sb.toString(), totCnt);
}
}

@ -1,48 +0,0 @@
package cokr.xit.ens.batch.sched;
import cokr.xit.ens.modules.common.code.StatCd;
import cokr.xit.ens.modules.common.domain.SendMast;
import cokr.xit.ens.modules.common.domain.repository.SendMastRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Component
@Profile("!local & !local-maria & !local-oracle & !local-test")
//@Profile({"prod-traffic", "prod-iup"})
@RequiredArgsConstructor
public class EnsScheduler {
private final SendMastRepository sendMastRepository;
/**
*
* -. "열람(open)" "마감(close)" .
*/
@Scheduled(cron = "0 */5 9-18 * * *")
@Transactional
public void closed() {
log.info("=======================================================");
List<SendMast> sendMastList = sendMastRepository.findAllByStatCdInAndCloseDtBefore(Arrays.asList(StatCd.sendcmplt, StatCd.open), LocalDateTime.now());
log.info("[ENS] 마감처리 - 총 {}건", sendMastList.size());
log.info("SendMastId {}", sendMastList.stream()
.map(row -> {
row.setStatCd(StatCd.close);
return row.getSendMastId();
})
.collect(Collectors.toList())
.toString());
log.info("=======================================================");
}
}
Loading…
Cancel
Save