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