|
|
|
@ -1,31 +1,29 @@
|
|
|
|
|
package cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
|
|
|
import cokr.xit.ens.modules.common.code.IntgrnDtlStatCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.code.PostSeCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.code.StatCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.code.TryStatCd;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.IntgrnSendDetail;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.IntgrnSendMast;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendMast;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.IntgrnDetailStatVO;
|
|
|
|
|
import cokr.xit.ens.modules.common.domain.SendMast;
|
|
|
|
|
import com.querydsl.core.BooleanBuilder;
|
|
|
|
|
import com.querydsl.core.types.Projections;
|
|
|
|
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendDetail.*;
|
|
|
|
|
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendMast.*;
|
|
|
|
|
import static cokr.xit.ens.modules.common.domain.QSendMast.*;
|
|
|
|
|
import static cokr.xit.ens.modules.kkoalimtalk.domain.QSendDetailKkoAlimtalk.*;
|
|
|
|
|
import static cokr.xit.ens.modules.kkomydoc.domain.QSendDetailKkoMydoc.*;
|
|
|
|
|
import static cokr.xit.ens.modules.kkotalk.domain.QSendDetailKkoTalk.*;
|
|
|
|
|
import static cokr.xit.ens.modules.ktsigntalk.direct.domain.QSendDetailKtSigntalk.*;
|
|
|
|
|
import static cokr.xit.ens.modules.ktsigntalk.gibis.domain.QSendDetailKtGibis.*;
|
|
|
|
|
import static cokr.xit.ens.modules.nvsigntalk.domain.QSendDetailNvSigntalk.*;
|
|
|
|
|
|
|
|
|
|
import java.time.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendDetail.intgrnSendDetail;
|
|
|
|
|
import static cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.QIntgrnSendMast.intgrnSendMast;
|
|
|
|
|
import static cokr.xit.ens.modules.common.domain.QSendMast.sendMast;
|
|
|
|
|
import static cokr.xit.ens.modules.kkoalimtalk.domain.QSendDetailKkoAlimtalk.sendDetailKkoAlimtalk;
|
|
|
|
|
import static cokr.xit.ens.modules.kkomydoc.domain.QSendDetailKkoMydoc.sendDetailKkoMydoc;
|
|
|
|
|
import static cokr.xit.ens.modules.ktsigntalk.direct.domain.QSendDetailKtSigntalk.sendDetailKtSigntalk;
|
|
|
|
|
import static cokr.xit.ens.modules.ktsigntalk.gibis.domain.QSendDetailKtGibis.sendDetailKtGibis;
|
|
|
|
|
import static cokr.xit.ens.modules.nvsigntalk.domain.QSendDetailNvSigntalk.sendDetailNvSigntalk;
|
|
|
|
|
import com.querydsl.core.*;
|
|
|
|
|
import com.querydsl.core.types.*;
|
|
|
|
|
import com.querydsl.jpa.impl.*;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.ens.core.utils.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.code.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.code.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.*;
|
|
|
|
|
import cokr.xit.ens.modules.common.domain.*;
|
|
|
|
|
import lombok.*;
|
|
|
|
|
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositoryCustom {
|
|
|
|
@ -49,10 +47,15 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void modifyDetailStatCdByIntgrnDetailStatVO(List<IntgrnDetailStatVO> list) {
|
|
|
|
|
list.forEach(data ->
|
|
|
|
|
|
|
|
|
|
list.forEach(data -> {
|
|
|
|
|
// FIXME: 카카오톡 추가 : null 처리
|
|
|
|
|
IntgrnDtlStatCd intgrnDtlStatCd = CmmnUtil.isEmpty(data.getCurStatCd()) ?
|
|
|
|
|
IntgrnDtlStatCd.UNKNOWN :
|
|
|
|
|
(IntgrnDtlStatCd.ACPT_CMPLT.equals(data.getCurStatCd().getIntgrnDtlStatCd()) ?
|
|
|
|
|
(CmmnUtil.isEmpty(data.getMastErrorCode()) ? data.getCurStatCd().getIntgrnDtlStatCd() : IntgrnDtlStatCd.FAIL)
|
|
|
|
|
: data.getCurStatCd().getIntgrnDtlStatCd());
|
|
|
|
|
query.update(intgrnSendDetail)
|
|
|
|
|
.set(intgrnSendDetail.curStatCd, IntgrnDtlStatCd.ACPT_CMPLT.equals(data.getCurStatCd().getIntgrnDtlStatCd()) ? (CmmnUtil.isEmpty(data.getMastErrorCode()) ? data.getCurStatCd().getIntgrnDtlStatCd() : IntgrnDtlStatCd.FAIL) : data.getCurStatCd().getIntgrnDtlStatCd())
|
|
|
|
|
.set(intgrnSendDetail.curStatCd, intgrnDtlStatCd)
|
|
|
|
|
.set(intgrnSendDetail.docSentDt, data.getDocSentDt())
|
|
|
|
|
.set(intgrnSendDetail.docReceivedDt, data.getDocReceivedDt())
|
|
|
|
|
.set(intgrnSendDetail.docAuthFrstDt, data.getDocAuthFrstDt())
|
|
|
|
@ -62,7 +65,8 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
.set(intgrnSendDetail.error.errorCode, data.getMastErrorCode() == null && data.getErrorCode() == null ? null : String.format("[M]%s. [D]%s", data.getMastErrorCode(), data.getErrorCode()))
|
|
|
|
|
.set(intgrnSendDetail.error.errorMessage, data.getMastErrorCode() == null && data.getErrorCode() == null ? null : String.format("[M]%s. [D]%s", data.getMastErrorMessage(), data.getErrorMessage()))
|
|
|
|
|
.where(intgrnSendDetail.intSendDetailId.eq(data.getIntSendDetailId()))
|
|
|
|
|
.execute()
|
|
|
|
|
.execute();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,6 +125,32 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
)
|
|
|
|
|
.fetch());
|
|
|
|
|
|
|
|
|
|
// FIXME: 카카오톡 추가
|
|
|
|
|
list.addAll(query.select(Projections.fields(IntgrnDetailStatVO.class
|
|
|
|
|
, intgrnSendDetail.intSendDetailId
|
|
|
|
|
, intgrnSendDetail.linkedUuid
|
|
|
|
|
, intgrnSendDetail.curPostSe
|
|
|
|
|
, sendDetailKkoTalk.status.as("status")
|
|
|
|
|
, sendDetailKkoTalk.sentAt.as("sentAt")
|
|
|
|
|
, sendDetailKkoTalk.receivedAt.as("receivedAt")
|
|
|
|
|
, sendDetailKkoTalk.authenticatedAt.as("authenticatedAt")
|
|
|
|
|
, sendDetailKkoTalk.ottVerifiedAt.as("ottVerifiedAt")
|
|
|
|
|
, sendDetailKkoTalk.readAt.as("readAt")
|
|
|
|
|
, sendDetailKkoTalk.userNotifiedAt.as("userNotifiedAt")
|
|
|
|
|
, sendDetailKkoTalk.error.errorCode
|
|
|
|
|
, sendDetailKkoTalk.error.errorMessage
|
|
|
|
|
, sendMast.error.errorCode.as("mastErrorCode")
|
|
|
|
|
, sendMast.error.errorMessage.as("mastErrorMessage")
|
|
|
|
|
))
|
|
|
|
|
.from(intgrnSendDetail)
|
|
|
|
|
.innerJoin(sendDetailKkoTalk).on(sendDetailKkoTalk.sendDetailId.eq(intgrnSendDetail.sendDetailIdKkoTalk))
|
|
|
|
|
.innerJoin(sendDetailKkoTalk.sendMast, sendMast)
|
|
|
|
|
.where(
|
|
|
|
|
intgrnSendDetail.curPostSe.eq(PostSeCd.kkoTalk)
|
|
|
|
|
.and(intgrnSendDetail.intgrnSendMast.intSendMastId.eq(intSendMastId))
|
|
|
|
|
)
|
|
|
|
|
.fetch());
|
|
|
|
|
|
|
|
|
|
list.addAll(query.select(Projections.fields(IntgrnDetailStatVO.class
|
|
|
|
|
, intgrnSendDetail.intSendDetailId
|
|
|
|
|
, intgrnSendDetail.linkedUuid
|
|
|
|
@ -236,6 +266,8 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
public Optional<IntgrnSendDetail> findByDocUuidAndLinkedUuid(String docUuid, String linkedUuid) {
|
|
|
|
|
List<Long> intSendDetailIds = new ArrayList<>();
|
|
|
|
|
intSendDetailIds.addAll(findIntSendDetailIdsByKkoMydoc(docUuid, linkedUuid));
|
|
|
|
|
// FIXME: 카카오톡 추가
|
|
|
|
|
intSendDetailIds.addAll(findIntSendDetailIdsByKkoTalk(docUuid, linkedUuid));
|
|
|
|
|
intSendDetailIds.addAll(findIntSendDetailIdsByNvSigntalk(docUuid, linkedUuid));
|
|
|
|
|
intSendDetailIds.addAll(findIntSendDetailIdsByKtSigntalk(docUuid, linkedUuid));
|
|
|
|
|
intSendDetailIds.addAll(findIntSendDetailIdsByKtGibis(docUuid, linkedUuid));
|
|
|
|
@ -247,6 +279,8 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
@Override
|
|
|
|
|
public PostSeCd findPostSeByDocUuidAndLinkedUuid(String docUuid, String linkedUuid) {
|
|
|
|
|
if (findIntSendDetailIdsByKkoMydoc(docUuid, linkedUuid).size() > 0) return PostSeCd.kkoMydoc;
|
|
|
|
|
// FIXME: 카카오톡 추가
|
|
|
|
|
if (findIntSendDetailIdsByKkoTalk(docUuid, linkedUuid).size() > 0) return PostSeCd.kkoTalk;
|
|
|
|
|
if (findIntSendDetailIdsByNvSigntalk(docUuid, linkedUuid).size() > 0) return PostSeCd.nvSigntalk;
|
|
|
|
|
if (findIntSendDetailIdsByKtSigntalk(docUuid, linkedUuid).size() > 0) return PostSeCd.ktSigntalk;
|
|
|
|
|
if (findIntSendDetailIdsByKtGibis(docUuid, linkedUuid).size() > 0) return PostSeCd.ktGibis;
|
|
|
|
@ -267,6 +301,15 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
.groupBy(intgrnSendDetail.intgrnSendMast.intSendMastId)
|
|
|
|
|
.fetchOne());
|
|
|
|
|
|
|
|
|
|
// FIXME: 카카오톡 추가
|
|
|
|
|
if (PostSeCd.kkoTalk.equals(sendMastObj.getPostSe()))
|
|
|
|
|
return Optional.ofNullable(query.select(intgrnSendDetail.intgrnSendMast.intSendMastId)
|
|
|
|
|
.from(intgrnSendDetail)
|
|
|
|
|
.innerJoin(sendDetailKkoTalk).on(intgrnSendDetail.sendDetailIdKkoTalk.eq(sendDetailKkoTalk.sendDetailId))
|
|
|
|
|
.where(sendDetailKkoTalk.sendMast.sendMastId.eq(sendMastId))
|
|
|
|
|
.groupBy(intgrnSendDetail.intgrnSendMast.intSendMastId)
|
|
|
|
|
.fetchOne());
|
|
|
|
|
|
|
|
|
|
if (PostSeCd.kkoAlimtalk.equals(sendMastObj.getPostSe()))
|
|
|
|
|
return Optional.ofNullable(query.select(intgrnSendDetail.intgrnSendMast.intSendMastId)
|
|
|
|
|
.from(intgrnSendDetail)
|
|
|
|
@ -315,6 +358,20 @@ public class IntgrnSendDetailRepositoryImpl implements IntgrnSendDetailRepositor
|
|
|
|
|
.fetch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME: 카카오톡 추가
|
|
|
|
|
private List<Long> findIntSendDetailIdsByKkoTalk(String docUuid, String linkedUuid) {
|
|
|
|
|
BooleanBuilder isMatched = new BooleanBuilder();
|
|
|
|
|
isMatched.and(sendDetailKkoTalk.envelopeId.eq(docUuid));
|
|
|
|
|
if (linkedUuid != null)
|
|
|
|
|
isMatched.and(intgrnSendDetail.linkedUuid.eq(linkedUuid));
|
|
|
|
|
|
|
|
|
|
return query.select(intgrnSendDetail.intSendDetailId)
|
|
|
|
|
.from(intgrnSendDetail)
|
|
|
|
|
.innerJoin(sendDetailKkoTalk).on(intgrnSendDetail.sendDetailIdKkoTalk.eq(sendDetailKkoTalk.sendDetailId))
|
|
|
|
|
.where(isMatched)
|
|
|
|
|
.fetch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Long> findIntSendDetailIdsByNvSigntalk(String docUuid, String linkedUuid) {
|
|
|
|
|
BooleanBuilder isMatched = new BooleanBuilder();
|
|
|
|
|
isMatched.and(sendDetailNvSigntalk.docId.eq(docUuid));
|
|
|
|
|