feat: 카카오톡 추가 반영 - send

main
Jonguk. Lim 2 months ago
parent 8a1b95a63e
commit 64b9d1e55a

@ -18,7 +18,8 @@ import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*;
import cokr.xit.ens.modules.common.domain.*; import cokr.xit.ens.modules.common.domain.*;
import cokr.xit.ens.modules.common.domain.repository.*; import cokr.xit.ens.modules.common.domain.repository.*;
import cokr.xit.ens.modules.common.domain.support.*; import cokr.xit.ens.modules.common.domain.support.*;
import cokr.xit.ens.modules.kkomydoc.domain.*; import cokr.xit.ens.modules.kkotalk.domain.*;
import cokr.xit.ens.modules.kkotalk.domain.repository.*;
import cokr.xit.ens.modules.kkotalk.model.*; import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkotalk.service.support.*; import cokr.xit.ens.modules.kkotalk.service.support.*;
import lombok.*; import lombok.*;
@ -236,14 +237,14 @@ public class KkoTalkService {
* @return * @return
*/ */
@Transactional(propagation = Propagation.SUPPORTS) @Transactional(propagation = Propagation.SUPPORTS)
public EnsResponseVO statBulk(Long sendMastId) { public EnsResponseVO<?> statBulk(Long sendMastId) {
try { try {
SendMast sendMast = sendMastRepository.findById(sendMastId) SendMast sendMast = sendMastRepository.findById(sendMastId)
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 자료가 없습니다.")); .orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 자료가 없습니다."));
if (!PostSeCd.kkoTalk.equals(sendMast.getPostSe())) if (!PostSeCd.kkoTalk.equals(sendMast.getPostSe()))
throw new EnsException(EnsErrCd.RSLT404, String.format("%s 자료가 아닙니다.", PostSeCd.kkoTalk.getCodeNm())); throw new EnsException(EnsErrCd.RSLT404, String.format("%s 자료가 아닙니다.", PostSeCd.kkoTalk.getCodeNm()));
if (!Arrays.asList(StatCd.sendok, StatCd.sendcmplt, StatCd.open).stream() if (Stream.of(StatCd.sendok, StatCd.sendcmplt, StatCd.open)
.anyMatch(statCd -> statCd.equals(sendMast.getStatCd()))) .noneMatch(statCd -> statCd.equals(sendMast.getStatCd())))
throw new EnsException(EnsErrCd.RSLT404, "전송성공/전송완료/열람중(sendok/sendcmplt/open) 단계가 아닙니다."); throw new EnsException(EnsErrCd.RSLT404, "전송성공/전송완료/열람중(sendok/sendcmplt/open) 단계가 아닙니다.");
} catch (EnsException e) { } catch (EnsException e) {
return EnsResponseVO.errBuilder() return EnsResponseVO.errBuilder()
@ -264,9 +265,9 @@ public class KkoTalkService {
public EnsResponseVO<?> statBulkAll() { public EnsResponseVO<?> statBulkAll() {
List<Long> sendMastIds = sendMastRepository.findAllByPostSeAndStatCdIn(PostSeCd.kkoTalk, Arrays.asList(StatCd.sendok, StatCd.sendcmplt, StatCd.open)) List<Long> sendMastIds = sendMastRepository.findAllByPostSeAndStatCdIn(PostSeCd.kkoTalk, Arrays.asList(StatCd.sendok, StatCd.sendcmplt, StatCd.open))
.stream() .stream()
.map(row -> row.getSendMastId()) .map(SendMast::getSendMastId)
.collect(Collectors.toList()); .collect(Collectors.toList());
if (sendMastIds.size() < 1) if (sendMastIds.isEmpty())
return EnsResponseVO.errBuilder() return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.RSLT404) .errCode(EnsErrCd.RSLT404)
.errMsg("\"전송성공/전송완료/열람중(sendok/sendcmplt/open)\" 상태인 자료가 없습니다") .errMsg("\"전송성공/전송완료/열람중(sendok/sendcmplt/open)\" 상태인 자료가 없습니다")
@ -276,8 +277,8 @@ public class KkoTalkService {
} }
private EnsResponseVO<?> stat(List<Long> sendMastIds) { private EnsResponseVO<?> stat(List<Long> sendMastIds) {
List<EnsResponseVO> resultInfo = sendMastIds.stream() List<?> resultInfo = sendMastIds.stream()
.map(sendMastId -> kkoTalkRsltFetcher.execute(sendMastId)) .map(kkoTalkRsltFetcher::execute)
.collect(Collectors.toList()); .collect(Collectors.toList());
return EnsResponseVO.okBuilder().resultInfo(resultInfo).build(); return EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
@ -293,7 +294,7 @@ public class KkoTalkService {
* @return * @return
*/ */
@Transactional @Transactional
public EnsResponseVO<?> tokenVerify(String orgCd, String envelopId, String token, String externalDocumentUuid) { public EnsResponseVO<?> tokenVerify(String orgCd, String envelopId, String token, String externalId) {
EnsResponseVO responseVO = null; EnsResponseVO responseVO = null;
try { try {
@ -303,6 +304,7 @@ public class KkoTalkService {
throw new EnsException(EnsErrCd.ERR401, "토큰(은)는 필수조건 입니다."); throw new EnsException(EnsErrCd.ERR401, "토큰(은)는 필수조건 입니다.");
OrgMng orgMng = orgMngService.find(orgCd).getResultInfo(); OrgMng orgMng = orgMngService.find(orgCd).getResultInfo();
// FIXME: 카카오톡 토큰검증 API 처리
KkotalkApiDTO.ValidTokenResponse resp = kkoTalkApi.validToken( KkotalkApiDTO.ValidTokenResponse resp = kkoTalkApi.validToken(
KkotalkApiDTO.ValidTokenRequest.builder() KkotalkApiDTO.ValidTokenRequest.builder()
.signguCode(orgMng.getOrgCd()) .signguCode(orgMng.getOrgCd())
@ -366,23 +368,23 @@ public class KkoTalkService {
} finally { } finally {
if (EnsErrCd.OK.equals(responseVO.getErrCode())) { if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
Map<String, Object> resultInfo = (Map<String, Object>) responseVO.getResultInfo(); Map<String, Object> resultInfo = (Map<String, Object>) responseVO.getResultInfo();
sendDetailKkoTalkTokenHistRepository.save(SendDetailKkoMydocTokenHist.builder() sendDetailKkoTalkTokenHistRepository.save(SendDetailKkoTalkTokenHist.builder()
.externalDocumentUuid(externalDocumentUuid) .envelopeId(envelopId)
.documentBinderUuid(envelopId) .envelopeId(externalId)
.token(token) .token(token)
.tokenStatus((String) resultInfo.get("token_status")) .tokenStatus((String) resultInfo.get("token_status"))
.tokenUsedAt((Long) resultInfo.get("token_used_at")) .tokenUsedAt((String) resultInfo.get("used_at"))
.docBoxSentAt((Long) resultInfo.get("doc_box_sent_at")) .sentAt((String) resultInfo.get("sent_at"))
.docBoxReceivedAt((Long) resultInfo.get("doc_box_received_at")) .receivedAt((String) resultInfo.get("received_at"))
.authenticatedAt((Long) resultInfo.get("authenticated_at")) .authenticatedAt((String) resultInfo.get("authenticated_at"))
.userNotifiedAt((Long) resultInfo.get("user_notified_at")) .userNotifiedAt((String) resultInfo.get("user_notified_at"))
.payload((String) resultInfo.get("payload")) .payload((String) resultInfo.get("payload"))
.signedAt((String) resultInfo.get("signed_at")) .signedAt((String) resultInfo.get("signed_at"))
.build()); .build());
} else { } else {
sendDetailKkoTalkTokenHistRepository.save(SendDetailKkoTalkTokenHist.builder() sendDetailKkoTalkTokenHistRepository.save(SendDetailKkoTalkTokenHist.builder()
.externalDocumentUuid(externalDocumentUuid) .envelopeId(envelopId)
.documentBinderUuid(envelopId) .externalId(externalId)
.token(token) .token(token)
.error(FieldError.initBuilder() .error(FieldError.initBuilder()
.errorCode(responseVO.getErrCode().getCode()) .errorCode(responseVO.getErrCode().getCode())
@ -404,7 +406,7 @@ public class KkoTalkService {
* @return * @return
*/ */
@Transactional(propagation = Propagation.SUPPORTS) @Transactional(propagation = Propagation.SUPPORTS)
public EnsResponseVO readCmplt(String orgCd, String envelopeId) { public EnsResponseVO<?> readCmplt(String orgCd, String envelopeId) {
EnsResponseVO responseVO = null; EnsResponseVO responseVO = null;
try { try {
@ -414,6 +416,7 @@ public class KkoTalkService {
throw new EnsException(EnsErrCd.ERR401, "문서식별번호(은)는 필수조건 입니다."); throw new EnsException(EnsErrCd.ERR401, "문서식별번호(은)는 필수조건 입니다.");
OrgMng orgMng = orgMngService.find(orgCd).getResultInfo(); OrgMng orgMng = orgMngService.find(orgCd).getResultInfo();
// FIXME: 카카오툭 토큰 확인 API 호출 처리
KkotalkApiDTO.KkotalkErrorDTO resp = kkoTalkApi.modifyStatus( KkotalkApiDTO.KkotalkErrorDTO resp = kkoTalkApi.modifyStatus(
KkotalkDTO.EnvelopeId.builder() KkotalkDTO.EnvelopeId.builder()
.envelopeId(envelopeId) .envelopeId(envelopeId)
@ -475,7 +478,7 @@ public class KkoTalkService {
* @return * @return
*/ */
@Transactional(propagation = Propagation.SUPPORTS) @Transactional(propagation = Propagation.SUPPORTS)
public EnsResponseVO sendResultProvide(Long sendMastId) { public EnsResponseVO<?> sendResultProvide(Long sendMastId) {
return kkoTalkRsltProvider.execute(sendMastId); return kkoTalkRsltProvider.execute(sendMastId);
} }

Loading…
Cancel
Save