|
|
@ -17,8 +17,8 @@ import org.springframework.stereotype.Component;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SndngSeCode;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SndngSeCode;
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
|
|
|
|
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kakao.v2.KkotalkApiDTO;
|
|
|
|
import kr.xit.biz.ens.model.kakao.v2.KkotalkDTO;
|
|
|
|
import kr.xit.biz.ens.model.kakao.v2.KkotalkDTO;
|
|
|
|
import kr.xit.biz.ens.model.kakao.v2.KkotalkDocDTO;
|
|
|
|
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.service.AbstractService;
|
|
|
|
import kr.xit.core.service.AbstractService;
|
|
|
@ -91,7 +91,7 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
errors = validate(reqDTO.getEnvelope(), errors);
|
|
|
|
errors = validate(reqDTO.getEnvelope(), errors);
|
|
|
|
|
|
|
|
|
|
|
|
final KkotalkDocDTO.Envelope envelope = reqDTO.getEnvelope();
|
|
|
|
final KkotalkApiDTO.Envelope envelope = reqDTO.getEnvelope();
|
|
|
|
if(envelope.getReviewExpiresAt() != null){
|
|
|
|
if(envelope.getReviewExpiresAt() != null){
|
|
|
|
if(envelope.getReviewExpiresAt().compareTo(envelope.getReadExpiresAt()) < 0){
|
|
|
|
if(envelope.getReviewExpiresAt().compareTo(envelope.getReadExpiresAt()) < 0){
|
|
|
|
errors.add("reviewExpiresAt=재열람 만료일시를 최조 열람 만료일시 보다 큰 날짜로 입력해주세요.");
|
|
|
|
errors.add("reviewExpiresAt=재열람 만료일시를 최조 열람 만료일시 보다 큰 날짜로 입력해주세요.");
|
|
|
@ -121,7 +121,7 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@TraceLogging
|
|
|
|
@TraceLogging
|
|
|
|
public KkotalkDocDTO.ValidTokenResponse validToken(final KkotalkDocDTO.ValidTokenRequest reqDTO) {
|
|
|
|
public KkotalkApiDTO.ValidTokenResponse validToken(final KkotalkApiDTO.ValidTokenRequest reqDTO) {
|
|
|
|
validate(reqDTO, null);
|
|
|
|
validate(reqDTO, null);
|
|
|
|
|
|
|
|
|
|
|
|
return webClient.exchangeKkotalk(
|
|
|
|
return webClient.exchangeKkotalk(
|
|
|
@ -130,7 +130,7 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
.replace("{TOKEN}", reqDTO.getToken()),
|
|
|
|
.replace("{TOKEN}", reqDTO.getToken()),
|
|
|
|
HttpMethod.valueOf(API_VALID_TOKEN[1]),
|
|
|
|
HttpMethod.valueOf(API_VALID_TOKEN[1]),
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
KkotalkDocDTO.ValidTokenResponse.class,
|
|
|
|
KkotalkApiDTO.ValidTokenResponse.class,
|
|
|
|
getRlaybsnmInfo(reqDTO));
|
|
|
|
getRlaybsnmInfo(reqDTO));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -163,11 +163,11 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
* : RECEIVE(수신,미수신) > READ(열람)/EXPIRED
|
|
|
|
* : RECEIVE(수신,미수신) > READ(열람)/EXPIRED
|
|
|
|
* </pre>
|
|
|
|
* </pre>
|
|
|
|
* @param reqDTO KkotalkDTO.EnvelopeId
|
|
|
|
* @param reqDTO KkotalkDTO.EnvelopeId
|
|
|
|
* @return KkotalkDocDTO.EnvelopeStatusResponse
|
|
|
|
* @return KkotalkApiDTO.EnvelopeStatusResponse
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@TraceLogging
|
|
|
|
@TraceLogging
|
|
|
|
public KkotalkDocDTO.EnvelopeStatusResponse findStatus(final KkotalkDocDTO.EnvelopeId reqDTO){
|
|
|
|
public KkotalkApiDTO.EnvelopeStatusResponse findStatus(final KkotalkApiDTO.EnvelopeId reqDTO){
|
|
|
|
validate(reqDTO, null);
|
|
|
|
validate(reqDTO, null);
|
|
|
|
|
|
|
|
|
|
|
|
String param = "{\"envelopeIds\":" + JsonUtils.toJson(List.of(reqDTO.getEnvelopeId())) + "}";
|
|
|
|
String param = "{\"envelopeIds\":" + JsonUtils.toJson(List.of(reqDTO.getEnvelopeId())) + "}";
|
|
|
@ -197,9 +197,9 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
|
|
|
|
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
List<KkotalkDocDTO.Envelope> envelopes = reqDTO.getEnvelopes();
|
|
|
|
List<KkotalkApiDTO.Envelope> envelopes = reqDTO.getEnvelopes();
|
|
|
|
for(int idx = 0; idx < envelopes.size(); idx++) {
|
|
|
|
for(int idx = 0; idx < envelopes.size(); idx++) {
|
|
|
|
final Set<ConstraintViolation<KkotalkDocDTO.Envelope>> list = validator.validate(envelopes.get(idx));
|
|
|
|
final Set<ConstraintViolation<KkotalkApiDTO.Envelope>> list = validator.validate(envelopes.get(idx));
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
|
|
int finalIdx = idx;
|
|
|
|
int finalIdx = idx;
|
|
|
@ -211,7 +211,7 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for(int idx = 0; idx < envelopes.size(); idx++) {
|
|
|
|
for(int idx = 0; idx < envelopes.size(); idx++) {
|
|
|
|
final KkotalkDocDTO.Envelope envelope = envelopes.get(idx);
|
|
|
|
final KkotalkApiDTO.Envelope envelope = envelopes.get(idx);
|
|
|
|
|
|
|
|
|
|
|
|
if(envelope.getReviewExpiresAt() != null){
|
|
|
|
if(envelope.getReviewExpiresAt() != null){
|
|
|
|
if(envelope.getReviewExpiresAt().compareTo(envelope.getReadExpiresAt()) < 0){
|
|
|
|
if(envelope.getReviewExpiresAt().compareTo(envelope.getReadExpiresAt()) < 0){
|
|
|
@ -282,13 +282,13 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ApiResponseDTO<KkotalkDocDTO.ValidTokenResponse> findMyDocReadyAndMblPage(final KkotalkDocDTO.ValidTokenRequest reqDTO) {
|
|
|
|
public ApiResponseDTO<KkotalkApiDTO.ValidTokenResponse> findMyDocReadyAndMblPage(final KkotalkApiDTO.ValidTokenRequest reqDTO) {
|
|
|
|
final String url = HOST + API_VALID_TOKEN[0].replace(ENVELOPE_ID, reqDTO.getEnvelopeId())
|
|
|
|
final String url = HOST + API_VALID_TOKEN[0].replace(ENVELOPE_ID, reqDTO.getEnvelopeId())
|
|
|
|
.replace("{TOKEN}", reqDTO.getToken());
|
|
|
|
.replace("{TOKEN}", reqDTO.getToken());
|
|
|
|
|
|
|
|
|
|
|
|
// 유효성 검증
|
|
|
|
// 유효성 검증
|
|
|
|
final KkotalkDocDTO.ValidTokenResponse validTokenRes = webClient.exchangeKkotalk(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null,
|
|
|
|
final KkotalkApiDTO.ValidTokenResponse validTokenRes = webClient.exchangeKkotalk(url, HttpMethod.valueOf(API_VALID_TOKEN[1]), null,
|
|
|
|
KkotalkDocDTO.ValidTokenResponse.class, getRlaybsnmInfo(reqDTO));
|
|
|
|
KkotalkApiDTO.ValidTokenResponse.class, getRlaybsnmInfo(reqDTO));
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: USED ??
|
|
|
|
// FIXME: USED ??
|
|
|
|
// if(!"USED".equals(validTokenRes.getStatus())){
|
|
|
|
// if(!"USED".equals(validTokenRes.getStatus())){
|
|
|
@ -300,7 +300,7 @@ public class KkotalkEltrcDocService extends AbstractService implements
|
|
|
|
|
|
|
|
|
|
|
|
// 정상 : HttpStatus.NO_CONTENT(204) return
|
|
|
|
// 정상 : HttpStatus.NO_CONTENT(204) return
|
|
|
|
// error : body에 error_code, error_message return
|
|
|
|
// error : body에 error_code, error_message return
|
|
|
|
final KkotalkDocDTO.KkotalkErrorDTO errorDTO = webClient.exchangeKkotalk(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), null, KkotalkDocDTO.KkotalkErrorDTO.class, getRlaybsnmInfo(reqDTO));
|
|
|
|
final KkotalkApiDTO.KkotalkErrorDTO errorDTO = webClient.exchangeKkotalk(url2, HttpMethod.valueOf(API_MODIFY_STATUS[1]), null, KkotalkApiDTO.KkotalkErrorDTO.class, getRlaybsnmInfo(reqDTO));
|
|
|
|
if(errorDTO != null){
|
|
|
|
if(errorDTO != null){
|
|
|
|
return ApiResponseDTO.error(errorDTO.getErrorCode(), errorDTO.getErrorMessage());
|
|
|
|
return ApiResponseDTO.error(errorDTO.getErrorCode(), errorDTO.getErrorMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|