Compare commits
No commits in common. 'prod-iup-NaverPay' and 'main' have entirely different histories.
prod-iup-N
...
main
@ -0,0 +1,12 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.model;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Schema(name = "IupAlimtalkReqVO")
|
||||||
|
public class IupAlimtalkReqVO {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "연계입수 아이디", example = " ")
|
||||||
|
private Long lnkInputId;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.mq;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.kafka.annotation.KafkaListener;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
//@Component
|
||||||
|
@Profile("prod-iup")
|
||||||
|
public class IupAlimtalkConsumer {
|
||||||
|
|
||||||
|
@Resource(name = "iupAlimtalkMakerLegacy")
|
||||||
|
// @Autowired
|
||||||
|
// private IupAlimtalkMakerLegacy iupAlimtalkMaker;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 제작요청
|
||||||
|
* @param message
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@KafkaListener(topics = "iup-kkoalimtalk-makereq", groupId = "group-id-ens")
|
||||||
|
public void subMakeReq(String message) throws IOException {
|
||||||
|
log.info("[iup-kkoalimtalk-makereq] sub message : " + message);
|
||||||
|
try {
|
||||||
|
Long sendMastId = Long.parseLong(message);
|
||||||
|
|
||||||
|
// iupAlimtalkMaker.make(sendMastId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.mq;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.kafka.core.KafkaTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class IupAlimtalkProducer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private KafkaTemplate<String, String> kafkaTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 제작요청
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
|
public void pubMakeReq(String message) {
|
||||||
|
final String topicName = "iup-kkoalimtalk-makereq";
|
||||||
|
|
||||||
|
log.info(String.format("[%s] pub message : %s", topicName, message));
|
||||||
|
|
||||||
|
this.kafkaTemplate.send(topicName, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.presentation;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.model.IupAlimtalkReqVO;
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.IupAlimtalkService;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Tag(name = "IupAlimtalkController")
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
public class IupAlimtalkController {
|
||||||
|
|
||||||
|
private final IupAlimtalkService iupAlimtalkService;
|
||||||
|
|
||||||
|
@Operation(summary = "접수")
|
||||||
|
@PostMapping(value = "/iup/alimtalk/accept", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> accept(@RequestBody IupAlimtalkReqVO reqDTO){
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.accept(reqDTO.getLnkInputId());
|
||||||
|
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "제작")
|
||||||
|
// @PutMapping(value = "/iup/alimtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
@PostMapping(value = "/iup/alimtalk/re/make", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> reMake(@RequestBody IupAlimtalkReqVO reqDTO){
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.reMake(reqDTO.getLnkInputId());
|
||||||
|
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "전송")
|
||||||
|
// @PutMapping(value = "/iup/alimtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
@PostMapping(value = "/iup/alimtalk/re/send", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> reSend(@RequestBody IupAlimtalkReqVO reqDTO){
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.reSend(reqDTO.getLnkInputId());
|
||||||
|
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "전송결과가져오기")
|
||||||
|
@PostMapping(value = "/iup/alimtalk/fetch", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> fetch(@RequestBody IupAlimtalkReqVO reqDTO){
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.fetch(reqDTO.getLnkInputId());
|
||||||
|
return new ResponseEntity<EnsResponseVO>(responseVO, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.sched;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.IupAlimtalkService;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
//@Component
|
||||||
|
//@Profile("prod-iup")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupAlimtalkScheduler {
|
||||||
|
|
||||||
|
private final IupAlimtalkService iupAlimtalkService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 접수
|
||||||
|
* -. 알림톡 전송을 위해 IUP에 등록된 기초데이터를 ENS에 이관 등록 한다.
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 */5 7-22 * * *")
|
||||||
|
public void accepted() {
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.acceptAll();
|
||||||
|
|
||||||
|
log.info("=======================================================");
|
||||||
|
log.info("[IUP] 알림톡 접수처리 결과");
|
||||||
|
log.info(responseVO.toString());
|
||||||
|
log.info("=======================================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 결과 가져오기
|
||||||
|
* -. 전송이 완료된 알림톡 전송결과(성공/실패)를 ENS -> IUP 로 가져온다.
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 */15 7-22 * * *")
|
||||||
|
public void fetched() {
|
||||||
|
EnsResponseVO responseVO = iupAlimtalkService.fetchAll();
|
||||||
|
|
||||||
|
log.info("=======================================================");
|
||||||
|
log.info("[IUP] 알림톡 전송결과 Fetch");
|
||||||
|
log.info(responseVO.toString());
|
||||||
|
log.info("=======================================================");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,164 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkAcceptor;
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkFetcher;
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkMaker;
|
||||||
|
import cokr.xit.ens.biz.iup.alimtalk.service.support.IupAlimtalkSender;
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.service.event.KkoAlimtalkSendReserveEvent;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Transactional
|
||||||
|
public class IupAlimtalkService {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private final TbInputXitRepository tbInputXitRepository;
|
||||||
|
|
||||||
|
private final IupAlimtalkAcceptor iupAlimtalkAcceptor;
|
||||||
|
private final IupAlimtalkMaker iupAlimtalkMaker;
|
||||||
|
private final IupAlimtalkSender iupAlimtalkSender;
|
||||||
|
private final IupAlimtalkFetcher iupAlimtalkFetcher;
|
||||||
|
|
||||||
|
private final ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 인증톡 접수(IUP -> ENS)
|
||||||
|
*/
|
||||||
|
public EnsResponseVO accept(Long lnkInputId){
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
TbInputXit tbInputXit = tbInputXitRepository.findByPrcsCdAndSendTypeAndId(IupPrcsCd.TGRG, IupSendTypeCd.NI, lnkInputId)
|
||||||
|
.orElseThrow(()->new EnsException(EnsErrCd.ACPT404, "일치하는 자료가 없거나 \"등록(TGRG)\" 상태가 아닙니다."));
|
||||||
|
|
||||||
|
return this.accept(Arrays.asList(tbInputXit)).getResultInfo().get(0);
|
||||||
|
} catch (EnsException e){
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 인증톡 접수(IUP -> ENS)
|
||||||
|
*/
|
||||||
|
public EnsResponseVO<List<EnsResponseVO>> acceptAll(){
|
||||||
|
try {
|
||||||
|
|
||||||
|
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRG), IupSendTypeCd.NI);
|
||||||
|
if(CmmnUtil.isEmpty(tbInputXits))
|
||||||
|
throw new EnsException(EnsErrCd.ACPT404, "\"등록(TGRG)\" 상태의 자료가 없습니다.");
|
||||||
|
|
||||||
|
return this.accept(tbInputXits);
|
||||||
|
} catch (EnsException e){
|
||||||
|
return EnsResponseVO.<List<EnsResponseVO>>errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private EnsResponseVO<List<EnsResponseVO>> accept(List<TbInputXit> tbInputXits){
|
||||||
|
iupAlimtalkAcceptor.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
List<EnsResponseVO> resultInfo = tbInputXits.stream()
|
||||||
|
.map(row -> iupAlimtalkAcceptor.execute(row.getLnkInputId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> sendMastIds = resultInfo.stream()
|
||||||
|
.filter(ensResponseVO -> EnsErrCd.OK.equals(ensResponseVO.getErrCode()))
|
||||||
|
.map(ensResponseVO -> (Long)((Map<String, Object>)ensResponseVO.getResultInfo()).get("sendMastId"))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
KkoAlimtalkSendReserveEvent event = KkoAlimtalkSendReserveEvent.builder()
|
||||||
|
.sendMastIds(sendMastIds)
|
||||||
|
.callback(() -> this.fetch(tbInputXits))
|
||||||
|
.build();
|
||||||
|
applicationEventPublisher.publishEvent(event);
|
||||||
|
|
||||||
|
return EnsResponseVO.<List<EnsResponseVO>>okBuilder().resultInfo(resultInfo).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 인증톡 제작 재요청
|
||||||
|
* @param lnkInputId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public EnsResponseVO reMake(Long lnkInputId){
|
||||||
|
return iupAlimtalkMaker.execute(lnkInputId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 인증톡 전송 재요청
|
||||||
|
* @param lnkInputId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public EnsResponseVO reSend(Long lnkInputId){
|
||||||
|
return iupAlimtalkSender.execute(lnkInputId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 인증톡 전송(성공/실패) 결과 가져오기
|
||||||
|
*/
|
||||||
|
public EnsResponseVO fetch(Long lnkInputId){
|
||||||
|
TbInputXit tbInputXit = null;
|
||||||
|
try {
|
||||||
|
tbInputXit = tbInputXitRepository.findById(lnkInputId)
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]와 일치하는 자료가 없습니다.", lnkInputId)));
|
||||||
|
if(!IupSendTypeCd.NI.equals(tbInputXit.getSendType()))
|
||||||
|
new EnsException(EnsErrCd.ERR404, String.format("[ lnkInputId %s ]는 인증톡 자료가 아닙니다.", lnkInputId));
|
||||||
|
} catch (EnsException e) {
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.fetch(Arrays.asList(tbInputXit));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 인증톡 전송(성공/실패) 결과 모두 가져오기
|
||||||
|
*/
|
||||||
|
public EnsResponseVO fetchAll(){
|
||||||
|
List<TbInputXit> tbInputXits = tbInputXitRepository.findAllByPrcsCdInAndSendType(Arrays.asList(IupPrcsCd.TGRC), IupSendTypeCd.NI);
|
||||||
|
|
||||||
|
return this.fetch(tbInputXits);
|
||||||
|
}
|
||||||
|
|
||||||
|
private EnsResponseVO fetch(List<TbInputXit> tbInputXits){
|
||||||
|
iupAlimtalkFetcher.statReady(tbInputXits.stream().map(row -> row.getLnkInputId()).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
return EnsResponseVO.okBuilder()
|
||||||
|
.resultInfo(
|
||||||
|
tbInputXits.stream()
|
||||||
|
.map(row -> iupAlimtalkFetcher.execute(row.getLnkInputId()))
|
||||||
|
.collect(Collectors.toList()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,430 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.billpay.service.IupBillPayApiServiceSupport;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbEnfrcLevRciv;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfo;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.VKakaoNoticeInfoSn;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbEnfrcLevRcivRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillReqSeCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.BillHist;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api.BillKkoClientApiSpec;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.code.BillKkoErrCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.TmpltMng;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.OrgMngRepository;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.repository.TmpltMngRepository;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.domain.SendDetailKkoAlimtalk;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.domain.repository.SendDetailKkoAlimtalkRepository;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("iupBillPayApiService_NI")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupBillPayApiAlimtalkService extends IupBillPayApiServiceSupport {
|
||||||
|
|
||||||
|
|
||||||
|
private final SendDetailKkoAlimtalkRepository sendDetailKkoAlimtalkRepository;
|
||||||
|
private final TmpltMngRepository sendTmpltMngRepository;
|
||||||
|
private final OrgMngRepository orgMngRepository;
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
|
||||||
|
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
|
||||||
|
private final TbEnfrcLevRcivRepository tbEnfrcLevRcivRepository;
|
||||||
|
private final BillKkoClientApiSpec billKkoClientApi;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 청구서 조회
|
||||||
|
*
|
||||||
|
* @param mParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public BillKkoApiRespDTO findNoticeInfo(Map<String, Object> mParam) {
|
||||||
|
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
|
||||||
|
// data.get("biller_user_key");
|
||||||
|
// data.get("billed_year_month");
|
||||||
|
// data.get("ordinal");
|
||||||
|
// data.get("biller_notice_key");
|
||||||
|
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
|
||||||
|
// data.get("user_birth");
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> respData = null;
|
||||||
|
BillKkoApiRespDTO respVO = null;
|
||||||
|
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
|
||||||
|
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
|
||||||
|
String.valueOf(data.get("biller_user_key")) : null;
|
||||||
|
final String userBirth = Optional.ofNullable(data.get("user_birth")).isPresent() ?
|
||||||
|
String.valueOf(data.get("user_birth")) : null;
|
||||||
|
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("orgCd")) : null;
|
||||||
|
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("billUid")) : null;
|
||||||
|
|
||||||
|
BillHist billHist = null;
|
||||||
|
try {
|
||||||
|
billHist = this.addBillHistByReqInfo(BillReqSeCd.NOTICE, billerUserKey, orgCd, billUid, mParam);
|
||||||
|
|
||||||
|
|
||||||
|
if (CmmnUtil.isEmpty(billerUserKey)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
|
||||||
|
}
|
||||||
|
if (CmmnUtil.isEmpty(orgCd)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
|
||||||
|
}
|
||||||
|
if (CmmnUtil.isEmpty(userBirth)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "생년월일이 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
|
||||||
|
if (!orgMng.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
|
||||||
|
}
|
||||||
|
Optional<SendDetailKkoAlimtalk> sendDetailKkoAlimtalk = sendDetailKkoAlimtalkRepository.findByMsgIdx(billerUserKey);
|
||||||
|
if (!sendDetailKkoAlimtalk.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세 자료가 없습니다.");
|
||||||
|
}
|
||||||
|
Optional<TmpltMng> sendTmpltMng = sendTmpltMngRepository.findFetchByOrgCdAndTmpltCdAndUseYn(orgCd, sendDetailKkoAlimtalk.get().getSendMast().getTmpltCd(), "Y");
|
||||||
|
if (!sendTmpltMng.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 템플릿정보가 없습니다.");
|
||||||
|
}
|
||||||
|
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
|
||||||
|
if (!tbInputDataXit.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
|
||||||
|
}
|
||||||
|
final String dataId = tbInputDataXit.get().getDataId();
|
||||||
|
|
||||||
|
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
|
||||||
|
if (!vKakaoNoticeInfoSn.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납부과 자료가 없습니다.");
|
||||||
|
}
|
||||||
|
if (!userBirth.equals(vKakaoNoticeInfoSn.get().getUserBirth())) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR402, "생년월일이 일치하지 않습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
respData = this.respNoticeSnData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfoSn.get());
|
||||||
|
|
||||||
|
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
if (dataId.length() < 20) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
|
||||||
|
}
|
||||||
|
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
|
||||||
|
if (!vKakaoNoticeInfo.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징수부과 자료가 없습니다.");
|
||||||
|
}
|
||||||
|
if (!userBirth.equals(vKakaoNoticeInfo.get().getUserBirth())) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E404;
|
||||||
|
throw new EnsException(EnsErrCd.ERR402, "생년월일이 일치하지 않습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
respData = this.respNoticeData(sendTmpltMng.get().getTitle(), orgMng.get(), vKakaoNoticeInfo.get());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
respVO = BillKkoApiRespDTO.okBuilder()
|
||||||
|
.data(respData)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
|
||||||
|
|
||||||
|
} catch (EnsException e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(kkoBillErrCd.getCode())
|
||||||
|
.message(kkoBillErrCd.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(BillKkoErrCd.E801.getCode())
|
||||||
|
.message(BillKkoErrCd.E801.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 납부 가능 조회
|
||||||
|
*
|
||||||
|
* @param mParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public BillKkoApiRespDTO findPrepayInfo(Map<String, Object> mParam) {
|
||||||
|
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
|
||||||
|
// data.get("biller_user_key");
|
||||||
|
// data.get("billed_year_month");
|
||||||
|
// data.get("ordinal");
|
||||||
|
// data.get("biller_notice_key");
|
||||||
|
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
|
||||||
|
// data.get("amount");
|
||||||
|
|
||||||
|
|
||||||
|
BillKkoApiRespDTO respVO = null;
|
||||||
|
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
|
||||||
|
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
|
||||||
|
String.valueOf(data.get("biller_user_key")) : null;
|
||||||
|
final int amount = Optional.ofNullable(data.get("amount")).isPresent() ?
|
||||||
|
(int) data.get("amount") : 0;
|
||||||
|
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("orgCd")) : null;
|
||||||
|
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("billUid")) : null;
|
||||||
|
|
||||||
|
BillHist billHist = null;
|
||||||
|
try {
|
||||||
|
billHist = this.addBillHistByReqInfo(BillReqSeCd.PREPAY, billerUserKey, orgCd, billUid, mParam);
|
||||||
|
|
||||||
|
|
||||||
|
if (CmmnUtil.isEmpty(billerUserKey)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
|
||||||
|
}
|
||||||
|
if (CmmnUtil.isEmpty(orgCd)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
|
||||||
|
if (!orgMng.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
|
||||||
|
}
|
||||||
|
Optional<TbInputDataXit> tbInputDataXit = tbInputDataXitRepository.findByLinkedUuid(billerUserKey);
|
||||||
|
if (!tbInputDataXit.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E402;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 발송상세정보가 없습니다.");
|
||||||
|
}
|
||||||
|
final String dataId = tbInputDataXit.get().getDataId();
|
||||||
|
Optional<VKakaoNoticeInfo> vKakaoNoticeInfo = Optional.ofNullable(null);
|
||||||
|
List<TbEnfrcLevRciv> tbEnfrcLevRcivs = new ArrayList<>();
|
||||||
|
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
if (dataId.length() < 20) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR403, "빌러코드가 20자리 미만 입니다.");
|
||||||
|
}
|
||||||
|
Optional<VKakaoNoticeInfoSn> vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId);
|
||||||
|
if (!vKakaoNoticeInfoSn.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E502;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 단순미납 자료가 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
respVO = billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPrepayApi(), mParam);
|
||||||
|
|
||||||
|
if ("OK".equals(respVO.getRes_code()))
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
|
||||||
|
else
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, String.format("[%s] %s", respVO.getRes_code(), respVO.getMessage()));
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
|
||||||
|
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20));
|
||||||
|
if (!vKakaoNoticeInfo.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E502;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 강제징구 자료가 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
tbEnfrcLevRcivs = tbEnfrcLevRcivRepository.findAllByEnfrcLevMastrIdAndDeleteAt(dataId.substring(0, 20), "N");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getAmount())
|
||||||
|
|| amount != Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E403;
|
||||||
|
throw new EnsException(EnsErrCd.ERR902
|
||||||
|
, String.format("납부 가능 금액이 없거나 일치하지 않습니다. (요청금액:%s, 실제금액:%s)"
|
||||||
|
, amount
|
||||||
|
, vKakaoNoticeInfo.get().getAmount()));
|
||||||
|
}
|
||||||
|
if (amount > Integer.parseInt(vKakaoNoticeInfo.get().getAmount())) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E501;
|
||||||
|
throw new EnsException(EnsErrCd.ERR902
|
||||||
|
, String.format("납부 가능 금액을 초과했습니다. (요청금액:%s, 실제금액:%s)"
|
||||||
|
, amount
|
||||||
|
, vKakaoNoticeInfo.get().getAmount()));
|
||||||
|
}
|
||||||
|
if (!vKakaoNoticeInfo.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E502;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 청구서자료가 없습니다.");
|
||||||
|
}
|
||||||
|
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.get().getPayExpireDate())) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "납부기한이 값이 없습니다.");
|
||||||
|
}
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
if (Integer.parseInt(vKakaoNoticeInfo.get().getPayExpireDate()) < Integer.parseInt(simpleDateFormat.format(new Date()))) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E506;
|
||||||
|
throw new EnsException(EnsErrCd.ERR902, "납부기한이 경과한 자료 입니다.");
|
||||||
|
}
|
||||||
|
if (tbEnfrcLevRcivs.size() > 0) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR903, "납부가 완료된 자료 입니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
respVO = BillKkoApiRespDTO.okBuilder()
|
||||||
|
.data(null)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
|
||||||
|
|
||||||
|
} catch (EnsException e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(kkoBillErrCd.getCode())
|
||||||
|
.message(kkoBillErrCd.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(BillKkoErrCd.E601.getCode())
|
||||||
|
.message(BillKkoErrCd.E601.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 납부결과 저장
|
||||||
|
*
|
||||||
|
* @param mParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
public BillKkoApiRespDTO addPayReultIfno(Map<String, Object> mParam) {
|
||||||
|
Map<String, Object> data = (Map<String, Object>) mParam.get("data");
|
||||||
|
// data.get("biller_user_key");
|
||||||
|
// data.get("billed_year_month");
|
||||||
|
// data.get("ordinal");
|
||||||
|
// data.get("biller_notice_key");
|
||||||
|
Map<String, Object> parameters = (Map<String, Object>) data.get("parameters");
|
||||||
|
// data.get("pay_by");
|
||||||
|
// data.get("pay_type");
|
||||||
|
// data.get("pay_detail1");
|
||||||
|
// data.get("pay_detail2");
|
||||||
|
// data.get("pay_detail3");
|
||||||
|
// data.get("amount");
|
||||||
|
// data.get("pay_amount");
|
||||||
|
// data.get("pay_fee_type");
|
||||||
|
// data.get("pay_fee");
|
||||||
|
// data.get("pay_fee_tax");
|
||||||
|
// data.get("adjust_date");
|
||||||
|
// data.get("paid_at");
|
||||||
|
// data.get("pay_id");
|
||||||
|
|
||||||
|
|
||||||
|
BillKkoApiRespDTO respVO = null;
|
||||||
|
BillKkoErrCd kkoBillErrCd = BillKkoErrCd.OK;
|
||||||
|
final String billerUserKey = Optional.ofNullable(data.get("biller_user_key")).isPresent() ?
|
||||||
|
String.valueOf(data.get("biller_user_key")) : null;
|
||||||
|
final String orgCd = Optional.ofNullable(parameters.get("orgCd")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("orgCd")) : null;
|
||||||
|
final String billUid = Optional.ofNullable(parameters.get("billUid")).isPresent() ?
|
||||||
|
String.valueOf(parameters.get("billUid")) : null;
|
||||||
|
|
||||||
|
BillHist billHist = null;
|
||||||
|
try {
|
||||||
|
billHist = this.addBillHistByReqInfo(BillReqSeCd.PAYRSLT, billerUserKey, orgCd, billUid, mParam);
|
||||||
|
|
||||||
|
|
||||||
|
if (CmmnUtil.isEmpty(billerUserKey)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "사용자식별키가 없습니다.");
|
||||||
|
}
|
||||||
|
if (CmmnUtil.isEmpty(orgCd)) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR401, "기관코드가 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Optional<OrgMng> orgMng = orgMngRepository.findById(orgCd);
|
||||||
|
if (!orgMng.isPresent()) {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR404, "일치하는 기관정보가 없습니다.");
|
||||||
|
}
|
||||||
|
if ("Y".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
return billKkoClientApi.callApiByOrg(orgMng.get().getKkoBpCsignPayresultApi(), mParam);
|
||||||
|
|
||||||
|
} else if ("N".equals(orgMng.get().getKkoBpCsignYn())) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
kkoBillErrCd = BillKkoErrCd.E601;
|
||||||
|
throw new EnsException(EnsErrCd.ERR999, "위탁업체여부 구분값이 등록되지 않았습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
respVO = BillKkoApiRespDTO.okBuilder()
|
||||||
|
.data(null)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, null, null);
|
||||||
|
} catch (EnsException e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(kkoBillErrCd.getCode())
|
||||||
|
.message(kkoBillErrCd.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, e.getErrCd(), e.getMessage());
|
||||||
|
} catch (Exception e) {
|
||||||
|
respVO = BillKkoApiRespDTO.errBuilder()
|
||||||
|
.resCode(BillKkoErrCd.E601.getCode())
|
||||||
|
.message(BillKkoErrCd.E601.getCodeNm())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.modifyBillHistByRespInfo(billHist, respVO, EnsErrCd.ERR999, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,294 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service.support;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
||||||
|
import cokr.xit.ens.core.utils.MapDeserailizer;
|
||||||
|
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
|
||||||
|
import cokr.xit.ens.modules.common.code.VenderCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.BillAcptReqDTO;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoAcptReqVO;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.config.CustomUrl;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.model.KkoAlimtalkAcceptReqDTO;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.model.config.*;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.bytebuddy.utility.RandomString;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupAlimtalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO, Long> {
|
||||||
|
|
||||||
|
private final TbInputXitRepository tbInputXitRepository;
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
|
||||||
|
private final KkoAlimtalkService kkoAlimtalkService;
|
||||||
|
|
||||||
|
Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).disableHtmlEscaping().create();
|
||||||
|
|
||||||
|
@Value("${contract.kakao.pay.bill.dozn.api.validate.host}")
|
||||||
|
private String BILL_HOST;
|
||||||
|
@Value("${contract.kakao.pay.bill.dozn.api.validate.notice}")
|
||||||
|
private String BILL_NOTICE_URL;
|
||||||
|
@Value("${contract.kakao.pay.bill.dozn.api.validate.prepay}")
|
||||||
|
private String BILL_PREPAY_URL;
|
||||||
|
@Value("${contract.kakao.pay.bill.dozn.api.validate.payresult}")
|
||||||
|
private String BILL_PAYREUSLT_URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accept 준비
|
||||||
|
*
|
||||||
|
* @param lnkInputIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statReady(List<Long> lnkInputIds) {
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
AtomicInteger index = new AtomicInteger();
|
||||||
|
String prefixLinkedUuid = String.format("B-KKOAT-%s%s", LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS")), RandomString.make(5));
|
||||||
|
lnkInputIds.stream()
|
||||||
|
.map(lnkInputId -> tbInputXitRepository.findById(lnkInputId).get())
|
||||||
|
.map(tbinput -> tbInputDataXitRepository.findAllByTbInputXit(tbinput))
|
||||||
|
.forEach(list -> {
|
||||||
|
list.stream()
|
||||||
|
.forEach(row -> {
|
||||||
|
log.info(row.toString());
|
||||||
|
// row.setLinkedUuid(String.format("%s%05d", prefixLinkedUuid, index.getAndIncrement() + 1));
|
||||||
|
row.setLinkedUuid(row.getDataId());
|
||||||
|
});
|
||||||
|
tbInputDataXitRepository.saveAll(list);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(EnsErrCd.ACPT500)
|
||||||
|
.errMsg(String.format("연계식별UUID 생성에 실패 했습니다. %s", e.getMessage()))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
EnsResponseVO respVO = null;
|
||||||
|
try {
|
||||||
|
/**
|
||||||
|
* 필수값 확인
|
||||||
|
*/
|
||||||
|
if (CmmnUtil.isEmpty(lnkInputIds))
|
||||||
|
throw new EnsException(EnsErrCd.ACPT410, "연계입수아이디(은)는 필수조건 입니다.");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 저장
|
||||||
|
* -. 발송마스터의 상태를 "대상이관등록(TGRI)" 으로 변경 한다.
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
|
||||||
|
.map(row -> {
|
||||||
|
row.setUpdId("ENS_SYS");
|
||||||
|
row.setPrcsCd(IupPrcsCd.TGRI);
|
||||||
|
return row.getLnkInputId();
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
|
||||||
|
} catch (EnsException e) {
|
||||||
|
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.ACPT999).errMsg(e.getMessage()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statBegin(Long arg) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 전자고지 접수
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO execute(Long lnkInputId) {
|
||||||
|
Map<String, Long> resultInfo = new HashMap<>();
|
||||||
|
resultInfo.put("lnkInputId", lnkInputId);
|
||||||
|
|
||||||
|
EnsResponseVO responseVO = null;
|
||||||
|
TbInputXit tbInputXit = null;
|
||||||
|
try {
|
||||||
|
tbInputXit = tbInputXitRepository.findById(lnkInputId)
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.ACPT404, String.format("일치하는 TB_INPUT_XIT 데이터가 없습니다. [ lnkInputId %s ]", lnkInputId)));
|
||||||
|
|
||||||
|
KkoAlimtalkAcceptReqDTO reqDTO = this.convertTbInputDataToAcceptReqDTO(tbInputDataXitRepository.findAllFetchByLnkInputId(tbInputXit.getLnkInputId()));
|
||||||
|
|
||||||
|
EnsResponseVO reqResp = kkoAlimtalkService.accept(reqDTO);
|
||||||
|
|
||||||
|
|
||||||
|
if (EnsErrCd.OK.equals(reqResp.getErrCode())) {
|
||||||
|
resultInfo.put("sendMastId", (Long) ((Map<String, Object>) reqResp.getResultInfo()).get("sendMastId"));
|
||||||
|
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
|
||||||
|
} else {
|
||||||
|
responseVO = EnsResponseVO.errRsltBuilder()
|
||||||
|
.errCode(reqResp.getErrCode())
|
||||||
|
.errMsg(reqResp.getErrMsg())
|
||||||
|
.resultInfo(reqResp.getResultInfo())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
} catch (EnsException e) {
|
||||||
|
responseVO = EnsResponseVO.errRsltBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(String.format("알림톡 \"접수\" 처리 실패. [%s] %s", e.getErrCd().getCode(), e.getMessage()))
|
||||||
|
.resultInfo(resultInfo)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
responseVO = EnsResponseVO.errRsltBuilder()
|
||||||
|
.errCode(EnsErrCd.ACPT500)
|
||||||
|
.errMsg(String.format("알림톡 \"접수\" 처리 실패. %s", e.getMessage()))
|
||||||
|
.resultInfo(resultInfo)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
|
||||||
|
tbInputXit.setUpdId("ENS_SYS");
|
||||||
|
tbInputXit.setPrcsCd(IupPrcsCd.TGRC);
|
||||||
|
tbInputXit.setErrMsg(null);
|
||||||
|
} else {
|
||||||
|
tbInputXit.setUpdId("ENS_SYS");
|
||||||
|
tbInputXit.setPrcsCd(IupPrcsCd.TGRF);
|
||||||
|
tbInputXit.setErrMsg(responseVO.getErrMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responseVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private KkoAlimtalkAcceptReqDTO convertTbInputDataToAcceptReqDTO(List<TbInputDataXit> list) {
|
||||||
|
|
||||||
|
return KkoAlimtalkAcceptReqDTO.builder()
|
||||||
|
.vender(VenderCd.biztalk.getCode())
|
||||||
|
.org_cd(list.get(0).getTbInputXit().getOrgCd())
|
||||||
|
// .tmplt_cd(list.get(0).getTbInputXit().getFsJob().getTemplateCd())
|
||||||
|
.tmplt_cd(list.get(0).getTbInputXit().getFsJob().getJobCd())
|
||||||
|
.post_bundle_title(
|
||||||
|
String.format("%s(%s건)-%s"
|
||||||
|
, IupSendTypeCd.NI.getCodeNm()
|
||||||
|
, list.get(0).getTbInputXit().getTotCnt()
|
||||||
|
, LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.send_dt(list.get(0).getTbInputXit().getRunDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
|
||||||
|
.close_dt(list.get(0).getTbInputXit().getExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
|
||||||
|
.documents(
|
||||||
|
list.stream()
|
||||||
|
.map(row -> createDocument(row))
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Document createDocument(TbInputDataXit data) throws EnsException {
|
||||||
|
|
||||||
|
return Document.builder()
|
||||||
|
// .msg_idx(data.getDataId())
|
||||||
|
.msg_idx(data.getLinkedUuid())
|
||||||
|
.country_code("82")
|
||||||
|
.recipient(data.getMoblphonNo())
|
||||||
|
.app_user_id(null)
|
||||||
|
.title(null)
|
||||||
|
.res_method("PUSH")
|
||||||
|
.attach(this.createAttach(data))
|
||||||
|
.supplement(this.createSupplement(data))
|
||||||
|
.message_type("AT")
|
||||||
|
.use_failback(null)
|
||||||
|
.mms_attach(this.createMmsAttach(data))
|
||||||
|
.xit_property(this.createXitProperty(data))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Attachment createAttach(TbInputDataXit data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Supplement createSupplement(TbInputDataXit data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MmsAttach createMmsAttach(TbInputDataXit data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private XitProperty createXitProperty(TbInputDataXit data) {
|
||||||
|
return XitProperty.builder()
|
||||||
|
// .bill_link_info(this.createBillLinkInfo(data))
|
||||||
|
.bill_acpt_data(this.createBillAcptData(data))
|
||||||
|
.tmplt_msg_data(CmmnUtil.isEmpty(data.getMsgData()) ? null : gson.fromJson(data.getMsgData().replace("~~@@!!", "#{").replace("!!@@~~", "}"), Map.class))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// return BillLinkInfo.builder()
|
||||||
|
// .button_name("납부하기")
|
||||||
|
// .button_type("WL")
|
||||||
|
// .expire_at(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
|
||||||
|
// .notice_url(this.BILL_HOST + this.BILL_NOTICE_URL)
|
||||||
|
// .prepay_url(this.BILL_HOST + this.BILL_PREPAY_URL)
|
||||||
|
// .pay_result_url(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
|
||||||
|
// .build();
|
||||||
|
// }
|
||||||
|
protected BillAcptReqDTO createBillAcptData(TbInputDataXit data) {
|
||||||
|
return BillAcptReqDTO.builder()
|
||||||
|
.use_bill_uid(false)
|
||||||
|
.bill_uid(null)
|
||||||
|
.bill_se(BillSeCd.bpKko)
|
||||||
|
.bill_kko(BillKkoAcptReqVO.builder()
|
||||||
|
.billUid(null)
|
||||||
|
.billerUserKey(data.getLinkedUuid())
|
||||||
|
.billedYearMonth(null)
|
||||||
|
.ordinal(null)
|
||||||
|
.billerNoticeKey(null)
|
||||||
|
.expireAt(data.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
|
||||||
|
.parameters(null)
|
||||||
|
.customUrl(CustomUrl.builder()
|
||||||
|
.noticeUrl(this.BILL_HOST + this.BILL_NOTICE_URL)
|
||||||
|
.prepayUrl(this.BILL_HOST + this.BILL_PREPAY_URL)
|
||||||
|
.payResultUrl(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
|
||||||
|
.build())
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,192 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service.support;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupPrcsCd;
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendSttusCd;
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputDataXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbSendResult;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbSendResultRepository;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
||||||
|
import cokr.xit.ens.core.utils.DateUtil;
|
||||||
|
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
|
||||||
|
import cokr.xit.ens.modules.common.code.StatCd;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.model.KkoAlimtalkRsltRespDTO;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupAlimtalkFetcher implements EnsPhaseProcSupport<EnsResponseVO, Long> {
|
||||||
|
|
||||||
|
private final TbInputXitRepository tbInputXitRepository;
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
|
||||||
|
private final TbSendResultRepository tbSendResultRepository;
|
||||||
|
|
||||||
|
private final KkoAlimtalkService kkoAlimtalkService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch 준비
|
||||||
|
* @param lnkInputIds
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statReady(List<Long> lnkInputIds) {
|
||||||
|
|
||||||
|
EnsResponseVO respVO = null;
|
||||||
|
try {
|
||||||
|
if (CmmnUtil.isEmpty(lnkInputIds))
|
||||||
|
throw new EnsException(EnsErrCd.RSLT410, "연계입수아이디(은)는 필수조건 입니다.");
|
||||||
|
|
||||||
|
|
||||||
|
List<Long> resultInfo = tbInputXitRepository.findAllByLnkInputIdIn(lnkInputIds).stream()
|
||||||
|
.map(row -> {
|
||||||
|
row.setUpdId("ENS_SYS");
|
||||||
|
row.setPrcsCd(IupPrcsCd.INCM);
|
||||||
|
return row.getLnkInputId();
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
;
|
||||||
|
respVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
|
||||||
|
} catch (EnsException e) {
|
||||||
|
respVO = EnsResponseVO.errBuilder().errCode(e.getErrCd()).errMsg(e.getMessage()).build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
respVO = EnsResponseVO.errBuilder().errCode(EnsErrCd.RSLT999).errMsg(e.getMessage()).build();
|
||||||
|
}
|
||||||
|
|
||||||
|
return respVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnsResponseVO statBegin(Long arg) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 발송(성공/실패) 자료에 대한 결과 가져오기
|
||||||
|
* @param lnkInputId
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO execute(Long lnkInputId){
|
||||||
|
EnsResponseVO responseVO = null;
|
||||||
|
Map<String, Object> resultInfo = new HashMap<>();
|
||||||
|
resultInfo.put("lnkInputId", lnkInputId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, "일치하는 ENS 접수자료가 없습니다."));
|
||||||
|
resultInfo.put("sendMastId", sendMastId);
|
||||||
|
|
||||||
|
|
||||||
|
EnsResponseVO apiRespVO = kkoAlimtalkService.sendResultProvide(sendMastId);
|
||||||
|
KkoAlimtalkRsltRespDTO respDTO = (KkoAlimtalkRsltRespDTO) apiRespVO.getResultInfo();
|
||||||
|
|
||||||
|
|
||||||
|
tbSendResultRepository.saveAll(respDTO.getDocuments().stream()
|
||||||
|
.map(row -> {
|
||||||
|
IupSendSttusCd iupSendSttusCd = null;
|
||||||
|
try {
|
||||||
|
switch (row.getKkoResultCd()){
|
||||||
|
case RS_1000:
|
||||||
|
iupSendSttusCd = IupSendSttusCd.RECV;
|
||||||
|
break;
|
||||||
|
case RS_1014:
|
||||||
|
case RS_1015:
|
||||||
|
case RS_3018:
|
||||||
|
iupSendSttusCd = IupSendSttusCd.NOMB;
|
||||||
|
break;
|
||||||
|
case RQ_B400:
|
||||||
|
case RQ_B401:
|
||||||
|
case RQ_B402:
|
||||||
|
case RQ_B403:
|
||||||
|
case RS_1021:
|
||||||
|
case RS_1025:
|
||||||
|
iupSendSttusCd = IupSendSttusCd.DENY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
iupSendSttusCd = IupSendSttusCd.FAIL;
|
||||||
|
break;
|
||||||
|
// iupSendSttusCd = IupSendSttusCd.SEND;
|
||||||
|
// iupSendSttusCd = IupSendSttusCd.RECV;
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
log.info("IupSendSttusCd와 일치하는 값 없음. [ dataId {} kkoResultCd {} ]", row.getMsgIdx(), row.getKkoResultCd());
|
||||||
|
}
|
||||||
|
return TbSendResult.builder()
|
||||||
|
.lnkInputId(lnkInputId)
|
||||||
|
// .dataId(row.getMsgIdx())
|
||||||
|
.dataId(tbInputDataXitRepository.findByLinkedUuid(row.getMsgIdx())
|
||||||
|
.orElse(new TbInputDataXit())
|
||||||
|
.getDataId())
|
||||||
|
.prcsOdr(StatCd.close.equals(respDTO.getStatCd())?"2":"1")
|
||||||
|
.sendSttusCd(iupSendSttusCd)
|
||||||
|
.sendType(IupSendTypeCd.NI)
|
||||||
|
.runDt(DateUtil.toLocalDateTime(respDTO.getSendDt()))
|
||||||
|
.bizSendDt(null)
|
||||||
|
.bizRecvDt(null)
|
||||||
|
.bizReadDt(null)
|
||||||
|
.bizErrMsg(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
|
||||||
|
.regId("ENS_SYS")
|
||||||
|
.regDt(LocalDateTime.now())
|
||||||
|
.expiresDt(DateUtil.toLocalDateTime(respDTO.getCloseDt()))
|
||||||
|
.prcsYn("N")
|
||||||
|
.build();
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
|
||||||
|
responseVO = EnsResponseVO.okBuilder().resultInfo(resultInfo).build();
|
||||||
|
} catch (EnsException e){
|
||||||
|
responseVO = EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
} catch (Exception e){
|
||||||
|
responseVO = EnsResponseVO.errBuilder()
|
||||||
|
.errCode(EnsErrCd.RSLT999)
|
||||||
|
.errMsg(String.format("[lnkInputId %s]에 대한 전송결과 FETCH 처리 실패. %s", lnkInputId, e.getMessage()))
|
||||||
|
.build();
|
||||||
|
} finally {
|
||||||
|
TbInputXit tbInputXit = tbInputXitRepository.findById(lnkInputId).orElseThrow(()->new EnsException(EnsErrCd.RSLT404, "일치하는 tbInputXit 자료가 없습니다."));
|
||||||
|
if(EnsErrCd.OK.equals(responseVO.getErrCode())){
|
||||||
|
tbInputXit.setUpdId("ENS_SYS");
|
||||||
|
tbInputXit.setPrcsCd(IupPrcsCd.IPCP);
|
||||||
|
tbInputXit.setErrMsg(null);
|
||||||
|
}else{
|
||||||
|
tbInputXit.setUpdId("ENS_SYS");
|
||||||
|
tbInputXit.setPrcsCd(IupPrcsCd.FAIL);
|
||||||
|
tbInputXit.setErrMsg(responseVO.getErrMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return responseVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service.support;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupAlimtalkMaker implements EnsPhaseProcSupport<EnsResponseVO, Long> {
|
||||||
|
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
|
||||||
|
private final KkoAlimtalkService kkoAlimtalkService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statReady(List<Long> lnkInputIds) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statBegin(Long arg) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 전자고지 제작
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO execute(Long lnkInputId){
|
||||||
|
EnsResponseVO responseVO = null;
|
||||||
|
try {
|
||||||
|
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, "일치하는 ENS 접수자료가 없습니다."));
|
||||||
|
|
||||||
|
responseVO = kkoAlimtalkService.make(sendMastId);
|
||||||
|
} catch (EnsException e){
|
||||||
|
responseVO = EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
return responseVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.alimtalk.service.support;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.code.IupSendTypeCd;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport;
|
||||||
|
import cokr.xit.ens.modules.kkoalimtalk.service.KkoAlimtalkService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IupAlimtalkSender implements EnsPhaseProcSupport<EnsResponseVO, Long> {
|
||||||
|
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
|
||||||
|
private final KkoAlimtalkService kkoAlimtalkService;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statReady(List<Long> lnkInputIds) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO statBegin(Long arg) {
|
||||||
|
log.info("no process");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 알림톡 전자고지 전송요청
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
public EnsResponseVO execute(Long lnkInputId){
|
||||||
|
EnsResponseVO responseVO = null;
|
||||||
|
try {
|
||||||
|
Long sendMastId = tbInputDataXitRepository.findLastSendMastIdByLnkInputIdAndSendType(lnkInputId, IupSendTypeCd.NI)
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.SEND404, "일치하는 ENS 접수자료가 없습니다."));
|
||||||
|
|
||||||
|
responseVO = kkoAlimtalkService.sendBulk(sendMastId);
|
||||||
|
} catch (EnsException e){
|
||||||
|
responseVO = EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
return responseVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,109 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.billpay.presentation;
|
||||||
|
|
||||||
|
import cokr.xit.ens.biz.iup.domain.TbInputXit;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputDataXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.domain.repository.TbInputXitRepository;
|
||||||
|
import cokr.xit.ens.biz.iup.signtalk.model.IupSigntalkReqVO;
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.utils.MapDeserailizer;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.impl.BillKkoClientServiceImpl;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Content;
|
||||||
|
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Tag(name = "IupBillPayRsltFwdController")
|
||||||
|
@Slf4j
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
public class IupBillPayRsltFwdController {
|
||||||
|
private final TbInputXitRepository tbInputXitRepository;
|
||||||
|
private final TbInputDataXitRepository tbInputDataXitRepository;
|
||||||
|
|
||||||
|
private final BillKkoClientServiceImpl billKkoClientServiceImpl;
|
||||||
|
private Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).disableHtmlEscaping().create();
|
||||||
|
|
||||||
|
@Operation(summary = "납부결과 전달(연계 입수 아이디)")
|
||||||
|
@PostMapping(value = "/iup/bill/payrslt/fwd/bulk", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> payrsltFwdBulk(@RequestBody IupSigntalkReqVO reqDTO) {
|
||||||
|
|
||||||
|
TbInputXit tbInputXit = tbInputXitRepository.findById(reqDTO.getLnkInputId())
|
||||||
|
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, String.format("연계입수아이디(%s)와 일치하는 자료가 없습니다.", reqDTO.getLnkInputId())));
|
||||||
|
List<String> billerUserKeys = tbInputDataXitRepository.findAllByTbInputXit(tbInputXit).stream()
|
||||||
|
.map(tbInputDataXit -> tbInputDataXit.getLinkedUuid())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
BillKkoApiRespDTO resultInfo = billKkoClientServiceImpl.fwdPayRslt(tbInputXit.getOrgCd(), billerUserKeys).getResultInfo();
|
||||||
|
|
||||||
|
return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
||||||
|
@Content(mediaType = "application/json", examples = {
|
||||||
|
@ExampleObject(name = "Sample Example..."
|
||||||
|
, summary = "sample"
|
||||||
|
, value = "{\"biller_user_key\":[\"abcd11234\",\"dddd1234\"]}")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
@Operation(summary = "납부결과 전달(빌러 유저 키)")
|
||||||
|
@PostMapping(value = "/iup/bill/payrslt/fwd/ids", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<EnsResponseVO> payrsltFwdIds(@RequestBody Map<String, List<String>> mParam) {
|
||||||
|
List<Map<String, Object>> data = mParam.get("biller_user_key").stream()
|
||||||
|
.map(s -> tbInputDataXitRepository.findById(s))
|
||||||
|
.filter(tbInputDataXit -> tbInputDataXit.isPresent())
|
||||||
|
.map(tbInputDataXit -> billKkoClientServiceImpl.fwdPayRslt(tbInputDataXit.get().getTbInputXit().getOrgCd(), Collections.singletonList(tbInputDataXit.get().getLinkedUuid())))
|
||||||
|
.map(ensResponseVO -> ensResponseVO.getResultInfo().getData())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
BillKkoApiRespDTO resultInfo = BillKkoApiRespDTO.okBuilder().data(data).build();
|
||||||
|
|
||||||
|
return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @Operation(summary = "[미전달분-일회성] - 납부결과 전달(2022.07.04 09:00:00 ~ 2022.07.05 15:00:00 데이터)")
|
||||||
|
// @PostMapping(value = "/iup/bill/payrslt/fwd/bulk/temp", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<EnsResponseVO> payrsltFwdBulkTemp() {
|
||||||
|
//
|
||||||
|
// List<BillKkoApiRespDTO> resultInfo = tbInputDataXitRepository.findAllByNoFwdPayResult().stream()
|
||||||
|
// .map(tbInputDataXit -> {
|
||||||
|
// String billerUserKey = tbInputDataXit.getLinkedUuid();
|
||||||
|
//
|
||||||
|
// OrgMng orgMng = orgMngRepository.findById(tbInputDataXit.getTbInputXit().getOrgCd()).orElse(null);
|
||||||
|
// if (orgMng == null)
|
||||||
|
// return BillKkoApiRespDTO.errBuilder().resCode(EnsErrCd.ERR404.getCode()).message(String.format("기관코드(%s)와 일치하는 자료가 없습니다. [ biller_user_key %s ]", tbInputDataXit.getTbInputXit().getOrgCd(), billerUserKey)).build();
|
||||||
|
//
|
||||||
|
// KkoBillHist kkoBillHist = kkoBillHistRepository.findByBillerUserKeyAndReqSeAndLast(billerUserKey, KkoBillReqSeCd.PAYRSLT).orElse(null);
|
||||||
|
// if (kkoBillHist == null)
|
||||||
|
// return BillKkoApiRespDTO.errBuilder().resCode(EnsErrCd.ERR404.getCode()).message(String.format(" 일치하는 청구서 납부결과가 없습니다. [ biller_user_key %s ]", billerUserKey)).build();
|
||||||
|
// else {
|
||||||
|
// String uri = orgMng.getKkoBpCsignPayresultApi();
|
||||||
|
// Map<String, Object> param = gson.fromJson(kkoBillHist.getRequestData(), Map.class);
|
||||||
|
// return kkoBillClientApi.callApiByOrg(uri, param);
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return new ResponseEntity<EnsResponseVO>(EnsResponseVO.okBuilder().resultInfo(resultInfo).build(), HttpStatus.OK);
|
||||||
|
// }
|
||||||
|
}
|
@ -1,135 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.presentation;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.IupPayUseSysServiceFactory;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Content;
|
|
||||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Tag(name = "IupPayUseSysController")
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@RestController
|
|
||||||
//public class IupPayUseSysController implements PayUseSysController<ResponseEntity, Map<String, Object>> {
|
|
||||||
public class IupPayUseSysController {
|
|
||||||
|
|
||||||
private final IupPayUseSysServiceFactory factory;
|
|
||||||
|
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
|
||||||
@Content(mediaType = "application/json", examples = {
|
|
||||||
@ExampleObject(name = "kkopay(카카오페이)"
|
|
||||||
, summary = "kkopay(카카오페이)"
|
|
||||||
, value = "{\"data\":{\"billerUserKey\":\"빌러유저키\"}}")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(name = "paySe", example = "kkopay", required = true, in = ParameterIn.PATH),
|
|
||||||
})
|
|
||||||
@Operation(summary = "청구서링크생성 정보")
|
|
||||||
@PostMapping(value = "/iup/bill/{paySe}/gnr/url", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity gnrUrl(@PathVariable String paySe, @RequestBody Map<String, Object> param) {
|
|
||||||
|
|
||||||
if (Arrays.stream(IupPayUseSysServiceFactory.IupPaySe.values()).noneMatch(iupPaySe -> iupPaySe.name().equals(paySe)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
return new ResponseEntity(factory.getService(IupPayUseSysServiceFactory.IupPaySe.valueOf(paySe)).gnrUrl(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
|
||||||
@Content(mediaType = "application/json", examples = {
|
|
||||||
@ExampleObject(name = "kkopay(카카오페이)"
|
|
||||||
, summary = "kkopay(카카오페이)"
|
|
||||||
, value = "{\"data\":{\"biller_user_key\":\"빌러유저키\",\"user_birth\":\"\",\"parameters\":{\"some_param\":\"\"}}}"),
|
|
||||||
@ExampleObject(name = "nvpay(네이버페이)"
|
|
||||||
, summary = "nvpay(네이버페이)"
|
|
||||||
, value = "{\"data\":{\"billerUserKey\":\"빌러유저키\"}}")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(name = "paySe", example = "kkopay", required = true, in = ParameterIn.PATH),
|
|
||||||
})
|
|
||||||
@Operation(summary = "납부(결제)정보")
|
|
||||||
@PostMapping(value = "/iup/bill/{paySe}/pay/notice", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity payNotice(@PathVariable String paySe, @RequestBody Map<String, Object> param) {
|
|
||||||
|
|
||||||
if (Arrays.stream(IupPayUseSysServiceFactory.IupPaySe.values()).noneMatch(iupPaySe -> iupPaySe.name().equals(paySe)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
return new ResponseEntity(factory.getService(IupPayUseSysServiceFactory.IupPaySe.valueOf(paySe)).payNotice(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
|
||||||
@Content(mediaType = "application/json", examples = {
|
|
||||||
@ExampleObject(name = "kkopay(카카오페이)"
|
|
||||||
, summary = "kkopay(카카오페이)"
|
|
||||||
, value = "{\"data\":{\"biller_user_key\":\"빌러유저키\",\"amount\":29000,\"parameters\":{\"pay_rqt_seq\":\"KT00000001\"}}}"),
|
|
||||||
@ExampleObject(name = "nvpay(네이버페이)"
|
|
||||||
, summary = "nvpay(네이버페이)"
|
|
||||||
, value = "{\"data\":{\"billerUserKey\":\"빌러유저키\",\"productName\":\"\",\"totalPayAmount\":1000,\"taxScopeAmount\":1000,\"taxExScopeAmount\":null}}")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(name = "paySe", example = "kkopay", required = true, in = ParameterIn.PATH),
|
|
||||||
})
|
|
||||||
@Operation(summary = "납부(결제)가능여부")
|
|
||||||
@PostMapping(value = "/iup/bill/{paySe}/pay/able", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity payAble(@PathVariable String paySe, @RequestBody Map<String, Object> param) {
|
|
||||||
if (Arrays.stream(IupPayUseSysServiceFactory.IupPaySe.values()).noneMatch(iupPaySe -> iupPaySe.name().equals(paySe)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
return new ResponseEntity(factory.getService(IupPayUseSysServiceFactory.IupPaySe.valueOf(paySe)).payAble(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
|
||||||
@Content(mediaType = "application/json", examples = {
|
|
||||||
@ExampleObject(name = "kkopay(카카오페이)"
|
|
||||||
, summary = "kkopay(카카오페이)"
|
|
||||||
, value = "{\"data\":{\"biller_user_key\":\"빌러유저키\",\"parameters\":{\"pay_rqt_seq\":\"KT00000001\"},\"pay_by\":\"MONEY\",\"pay_type\":\"P\",\"pay_detail1\":\"\",\"pay_detail2\":\"\",\"amount\":20000,\"pay_amount\":20000,\"pay_fee_type\":\"BEFORE\",\"pay_fee\":150,\"pay_fee_tax\":15,\"paid_at\":\"20190220161656\",\"pay_id\":2748877}}"),
|
|
||||||
@ExampleObject(name = "nvpay(네이버페이)"
|
|
||||||
, summary = "nvpay(네이버페이)"
|
|
||||||
, value = "{\"code\":\"Success\",\"message\":\"detail message(optional)\",\"body\":{\"paymentId\":\"네이버페이 결제번호\",\"detail\":{\"productName\":\"샘플상품\",\"merchantId\":\"loginId\",\"merchantName\":\"가맹점명\",\"cardNo\":\"465887**********\",\"admissionYmdt\":\"20170201151722\",\"payHistId\":\"20170201NP1043587781\",\"totalPayAmount\":1000,\"primaryPayAmount\":1000,\"npointPayAmount\":0,\"giftCardAmount\":0,\"taxScopeAmount\":1000,\"taxExScopeAmount\":0,\"environmentDepositAmount\":0,\"primaryPayMeans\":\"CARD\",\"merchantPayKey\":\"청구서UID\",\"merchantUserKey\":\"빌러유저키\",\"cardCorpCode\":\"C0\",\"paymentId\":\"20170201NP1043587746\",\"admissionTypeCode\":\"01\",\"settleExpectAmount\":971,\"payCommissionAmount\":29,\"admissionState\":\"SUCCESS\",\"tradeConfirmYmdt\":\"20170201152510\",\"cardAuthNo\":\"17545616\",\"cardInstCount\":0,\"usedCardPoint\":false,\"bankCorpCode\":\"\",\"bankAccountNo\":\"\",\"settleExpected\":false,\"extraDeduction\":false,\"useCfmYmdt\":\"20180703\"}}}")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(name = "paySe", example = "kkopay", required = true, in = ParameterIn.PATH),
|
|
||||||
})
|
|
||||||
@Operation(summary = "납부(결제)결과")
|
|
||||||
@PostMapping(value = "/iup/bill/{paySe}/pay/result", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity payResult(@PathVariable String paySe, @RequestBody Map<String, Object> param) {
|
|
||||||
|
|
||||||
if (Arrays.stream(IupPayUseSysServiceFactory.IupPaySe.values()).noneMatch(iupPaySe -> iupPaySe.name().equals(paySe)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
return new ResponseEntity(factory.getService(IupPayUseSysServiceFactory.IupPaySe.valueOf(paySe)).payResult(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
@io.swagger.v3.oas.annotations.parameters.RequestBody(required = true, content = {
|
|
||||||
@Content(mediaType = "application/json", examples = {
|
|
||||||
@ExampleObject(name = "nvpay(네이버페이)"
|
|
||||||
, summary = "nvpay(네이버페이)"
|
|
||||||
, value = "{\"code\":\"Success\",\"message\":\"detail message(optional)\",\"body\":{\"responseCount\":1,\"totalCount\":1,\"totalPageCount\":1,\"currentPageNumber\":1,\"list\":[{\"cardAuthNo\":\"00000000\",\"bankAccountNo\":\"\",\"bankCorpCode\":\"\",\"paymentId\":\"20170000NP1000229665\",\"cardCorpCode\":\"C0\",\"cardInstCount\":0,\"usedCardPoint\":false,\"settleInfo\":{\"primaryCommissionAmount\":30,\"npointCommissionAmount\":20,\"giftCardCommissionAmount\":0,\"primarySettleAmount\":470,\"npointSettleAmount\":480,\"giftCardSettleAmount\":0,\"totalSettleAmount\":850,\"totalCommissionAmount\":50,\"settleCreated\":true},\"merchantName\":\"나의가맹점\",\"productName\":\"나의상품\",\"payHistId\":\"20170000NP1000229668\",\"merchantId\":\"MID12345\",\"admissionYmdt\":\"20170914163930\",\"tradeConfirmYmdt\":\"20170915163956\",\"totalPayAmount\":1000,\"merchantPayKey\":\"orderKey-91516397\",\"merchantUserKey\":\"빌러유저키\",\"admissionTypeCode\":\"01\",\"primaryPayMeans\":\"CARD\",\"admissionState\":\"SUCCESS\",\"primaryPayAmount\":500,\"npointPayAmount\":500,\"giftCardPayAmount\":0,\"taxScopeAmount\":1000,\"taxExScopeAmount\":0,\"environmentDepositAmount\":0,\"cardNo\":\"123456**********\",\"extraDeduction\":false,\"useCfmYmdt\":\"20180703\"}]}}")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(name = "paySe", example = "kkopay", required = true, in = ParameterIn.PATH),
|
|
||||||
})
|
|
||||||
@Operation(summary = "결제취소정보")
|
|
||||||
@PostMapping(value = "/iup/bill/{paySe}/pay/cancel", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity payCancel(@PathVariable String paySe, @RequestBody Map<String, Object> param) {
|
|
||||||
|
|
||||||
if (Arrays.stream(IupPayUseSysServiceFactory.IupPaySe.values()).noneMatch(iupPaySe -> iupPaySe.name().equals(paySe)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
return new ResponseEntity(factory.getService(IupPayUseSysServiceFactory.IupPaySe.valueOf(paySe)).payCancel(param), HttpStatus.OK);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service;
|
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.PayProcessService;
|
|
||||||
|
|
||||||
public interface IupPayUseSysService<T, P> extends PayProcessService<T, P> {
|
|
||||||
}
|
|
@ -1,32 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.impl.IupKkoPayUseSysServiceImpl;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.impl.IupNvPayUseSysServiceImpl;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class IupPayUseSysServiceFactory {
|
|
||||||
private final IupKkoPayUseSysServiceImpl iupKkoPayUseSysService;
|
|
||||||
private final IupNvPayUseSysServiceImpl iupNvPayUseSysService;
|
|
||||||
|
|
||||||
public enum IupPaySe {
|
|
||||||
kkopay,
|
|
||||||
nvpay
|
|
||||||
}
|
|
||||||
|
|
||||||
public IupPayUseSysService getService(IupPaySe iupPaySe) {
|
|
||||||
switch (iupPaySe) {
|
|
||||||
case kkopay:
|
|
||||||
return iupKkoPayUseSysService;
|
|
||||||
case nvpay:
|
|
||||||
return iupNvPayUseSysService;
|
|
||||||
default:
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_REQUEST_URL, EnsErrCd.INVALID_REQUEST_URL.getCodeNm());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,86 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.impl;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.IupPayUseSysService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupKkoPayAbleService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupKkoPayNoticeService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupKkoPayResultService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupKkoPayUrlService;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayNoticeRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayUrlRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.Pay;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.template.PayHelper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class IupKkoPayUseSysServiceImpl implements IupPayUseSysService<PayApiRespDTO, Map<String, Object>> {
|
|
||||||
|
|
||||||
private final IupKkoPayUrlService iupKkoPayUrlService;
|
|
||||||
private final IupKkoPayNoticeService iupKkoPayNoticeService;
|
|
||||||
private final IupKkoPayAbleService iupKkoPayAbleService;
|
|
||||||
private final IupKkoPayResultService iupKkoPayResultService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO gnrUrl(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<KkoPayUrlRespData>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<KkoPayUrlRespData>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupKkoPayUrlService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payNotice(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<KkoPayNoticeRespData>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<KkoPayNoticeRespData>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupKkoPayNoticeService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payAble(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<Map<String, Object>>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupKkoPayAbleService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payResult(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<Map<String, Object>>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupKkoPayResultService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payCancel(Map<String, Object> param) {
|
|
||||||
return PayApiRespDTO.errBuilder()
|
|
||||||
.resCode(EnsErrCd.SERVICE_NOT_SUPPORTED.getCode())
|
|
||||||
.message(EnsErrCd.SERVICE_NOT_SUPPORTED.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,81 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.impl;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.IupPayUseSysService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupNvPayAbleService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupNvPayCancelService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupNvPayNoticeService;
|
|
||||||
import cokr.xit.ens.biz.iup.billpay.service.process.IupNvPayResultService;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.model.NvPayNoticeRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.Pay;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.template.PayHelper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class IupNvPayUseSysServiceImpl implements IupPayUseSysService<PayApiRespDTO, Map<String, Object>> {
|
|
||||||
|
|
||||||
private final IupNvPayNoticeService iupNvPayNoticeService;
|
|
||||||
private final IupNvPayAbleService iupNvPayAbleService;
|
|
||||||
private final IupNvPayResultService iupNvPayResultService;
|
|
||||||
private final IupNvPayCancelService iupNvPayCancelService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO gnrUrl(Map<String, Object> param) {
|
|
||||||
return PayApiRespDTO.errBuilder()
|
|
||||||
.resCode(EnsErrCd.SERVICE_NOT_SUPPORTED.getCode())
|
|
||||||
.message(EnsErrCd.SERVICE_NOT_SUPPORTED.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payNotice(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<NvPayNoticeRespData>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<NvPayNoticeRespData>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupNvPayNoticeService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payAble(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<Map<String, Object>>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupNvPayAbleService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payResult(Map<String, Object> param) {
|
|
||||||
Pay<PayApiRespDTO<Map<String, Object>>> pay = PayHelper.<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>>builder()
|
|
||||||
.param(param)
|
|
||||||
.payHelperService(iupNvPayResultService)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
pay.exec();
|
|
||||||
|
|
||||||
return pay.getResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO payCancel(Map<String, Object> param) {
|
|
||||||
return PayApiRespDTO.errBuilder()
|
|
||||||
.resCode(EnsErrCd.SERVICE_NOT_SUPPORTED.getCode())
|
|
||||||
.message(EnsErrCd.SERVICE_NOT_SUPPORTED.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,217 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbEnfrcLevMastrRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.PayUseSysApi;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayAbleService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupKkoPayAbleService implements PayAbleService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
|
|
||||||
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
|
|
||||||
private final TbEnfrcLevMastrRepository tbEnfrcLevMastrRepository;
|
|
||||||
private final PayUseSysApi payUseSysApi;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
payApiRespDTO,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
// Integer amount = (Integer) reqData.get("amount");
|
|
||||||
|
|
||||||
if (billerUserKey == null) billerUserKey = "";
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
final String dataId = tbInputDataXit.getDataId();
|
|
||||||
|
|
||||||
if ("Y".equals(fsJob.getBpEntrustYn()) || "y".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
|
|
||||||
final String url = fsJob.getBpKkoPrepayApi();
|
|
||||||
|
|
||||||
VKakaoNoticeInfoSn vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId)
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 단순미납부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfoSn)
|
|
||||||
.map(entity -> payUseSysApi.payAble(url, reqParam, null))
|
|
||||||
.map(response -> checkResponse(response))
|
|
||||||
.map(payApiRespDTO -> loadRespData(data, payApiRespDTO))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "단순미납 응답데이터 수신에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else if ("N".equals(fsJob.getBpEntrustYn()) || "n".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
if (dataId.length() < 20)
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "데이터ID가 20자리 미만 입니다.");
|
|
||||||
VKakaoNoticeInfo vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 강제징수부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfo)
|
|
||||||
.map(entity -> validateData(reqParam, entity));
|
|
||||||
TbEnfrcLevMastr tbEnfrcLevMastr = tbEnfrcLevMastrRepository.findByEnfrcLevMastrIdAndEnfrcLevMastrProcessSttusAndDeleteAt(dataId.substring(0, 20), "04", "N")
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "납부가능 상태가 아닙니다.", PayUseSysResCd.NO_TARGET_PAYABLE));
|
|
||||||
Optional.of(tbEnfrcLevMastr)
|
|
||||||
.map(entity -> createRespData())
|
|
||||||
.map(payApiRespDTO -> loadRespData(data, payApiRespDTO))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "강제징수 응답데이터 생성에 실패했습니다."));
|
|
||||||
} else {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "위탁여부가 등록되지 않았습니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO<Map<String, Object>> checkResponse(ResponseEntity<String> response) {
|
|
||||||
|
|
||||||
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
||||||
throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
||||||
|
|
||||||
PayApiRespDTO<Map<String, Object>> result = null;
|
|
||||||
try {
|
|
||||||
result = gson.fromJson(response.getBody(), PayApiRespDTO.class);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_RESPONSE, EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO loadRespData(Map<String, Object> data, PayApiRespDTO payApiRespDTO) {
|
|
||||||
if (CmmnUtil.isEmpty(payApiRespDTO))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
data.put(DataKeys.payApiRespDTO.name(), payApiRespDTO);
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), gson.toJson(payApiRespDTO));
|
|
||||||
return payApiRespDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
private VKakaoNoticeInfo validateData(Map<String, Object> reqParam, VKakaoNoticeInfo vKakaoNoticeInfo) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
|
|
||||||
final Integer amount = (Integer) reqData.getOrDefault("amount", 0);
|
|
||||||
if (amount != Integer.parseInt(vKakaoNoticeInfo.getAmount()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, String.format("납부 가능 금액이 없거나 일치하지 않습니다. (요청금액:%s, 실제금액:%s)", amount, vKakaoNoticeInfo.getAmount())
|
|
||||||
, PayUseSysResCd.NO_AMOUNT_PAYABLE);
|
|
||||||
if (amount > Integer.parseInt(vKakaoNoticeInfo.getAmount()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, String.format("납부 가능 금액을 초과했습니다. (요청금액:%s, 실제금액:%s)", amount, vKakaoNoticeInfo.getAmount())
|
|
||||||
, PayUseSysResCd.OVERPAYABLE_AMOUNT);
|
|
||||||
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.getPayExpireDate()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, "납부기한의 값이 비어있습니다."
|
|
||||||
, PayUseSysResCd.EXPIRED_DATE);
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
||||||
if (Integer.parseInt(vKakaoNoticeInfo.getPayExpireDate()) < Integer.parseInt(simpleDateFormat.format(new Date())))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, "납부기한이 경과한 자료 입니다."
|
|
||||||
, PayUseSysResCd.EXPIRED_DATE);
|
|
||||||
|
|
||||||
return vKakaoNoticeInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO createRespData() {
|
|
||||||
return PayApiRespDTO.okBuilder().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<Map<String, Object>> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
PayApiRespDTO payApiRespDTO = (PayApiRespDTO) data.get(DataKeys.payApiRespDTO.name());
|
|
||||||
return gson.fromJson(gson.toJson(payApiRespDTO), PayApiRespDTO.class);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (e.getData() != null && e.getData() instanceof PayUseSysResCd) {
|
|
||||||
PayUseSysResCd resCode = (PayUseSysResCd) e.getData();
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errBuilder()
|
|
||||||
.resCode(resCode.getCode())
|
|
||||||
.message(resCode.getCodeNm())
|
|
||||||
.build();
|
|
||||||
} else {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errBuilder()
|
|
||||||
.resCode(PayUseSysResCd.FAILED_CHECK_INFO.getCode())
|
|
||||||
.message(PayUseSysResCd.FAILED_CHECK_INFO.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.kakaoPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payAble)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,227 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayNoticeRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayNoticeService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupKkoPayNoticeService implements PayNoticeService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<KkoPayNoticeRespData>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
|
|
||||||
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
kkoPayNoticeRespData,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum PayDataKeys {
|
|
||||||
billerUserKey,
|
|
||||||
userBirth,
|
|
||||||
amount,
|
|
||||||
payExpireDate,
|
|
||||||
detailPasngChrgeSm,
|
|
||||||
detailAdiPasngChrgeSm,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
|
|
||||||
if (billerUserKey == null) billerUserKey = "";
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
final String dataId = tbInputDataXit.getDataId();
|
|
||||||
|
|
||||||
if ("Y".equals(fsJob.getBpEntrustYn()) || "y".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
VKakaoNoticeInfoSn vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId)
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 단순미납부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfoSn)
|
|
||||||
.map(entity -> toDataMap(entity))
|
|
||||||
.map(payData -> validateData(reqParam, payData))
|
|
||||||
.map(payData -> createRespData(tbInputDataXit, payData))
|
|
||||||
.map(kkoPayNoticeRespData -> loadRespData(data, kkoPayNoticeRespData))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "단순미납 응답데이터 생성에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else if ("N".equals(fsJob.getBpEntrustYn()) || "n".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
if (dataId.length() < 20)
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "데이터ID가 20자리 미만 입니다.");
|
|
||||||
VKakaoNoticeInfo vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 강제징수부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfo)
|
|
||||||
.map(entity -> toDataMap(entity))
|
|
||||||
.map(map -> validateData(reqParam, map))
|
|
||||||
.map(map -> createRespData(tbInputDataXit, map))
|
|
||||||
.map(kkoPayNoticeRespData -> loadRespData(data, kkoPayNoticeRespData))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "강제징수 응답데이터 생성에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "위탁여부가 등록되지 않았습니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> toDataMap(VKakaoNoticeInfoSn vKakaoNoticeInfoSn) {
|
|
||||||
Map<PayDataKeys, Object> payData = new HashMap<>();
|
|
||||||
payData.put(PayDataKeys.billerUserKey, vKakaoNoticeInfoSn.getDataId());
|
|
||||||
payData.put(PayDataKeys.userBirth, vKakaoNoticeInfoSn.getUserBirth());
|
|
||||||
payData.put(PayDataKeys.amount, vKakaoNoticeInfoSn.getAmount().intValue());
|
|
||||||
payData.put(PayDataKeys.payExpireDate, vKakaoNoticeInfoSn.getPayExpireDate());
|
|
||||||
payData.put(PayDataKeys.detailPasngChrgeSm, vKakaoNoticeInfoSn.getDetailPasngChrgeSm());
|
|
||||||
payData.put(PayDataKeys.detailAdiPasngChrgeSm, vKakaoNoticeInfoSn.getDetailAdiPasngChrgeSm());
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> toDataMap(VKakaoNoticeInfo vKakaoNoticeInfo) {
|
|
||||||
Map<PayDataKeys, Object> payData = new HashMap<>();
|
|
||||||
payData.put(PayDataKeys.billerUserKey, vKakaoNoticeInfo.getEnfrcLevMastrId());
|
|
||||||
payData.put(PayDataKeys.userBirth, vKakaoNoticeInfo.getUserBirth());
|
|
||||||
payData.put(PayDataKeys.amount, Integer.parseInt(vKakaoNoticeInfo.getAmount()));
|
|
||||||
payData.put(PayDataKeys.payExpireDate, vKakaoNoticeInfo.getPayExpireDate());
|
|
||||||
payData.put(PayDataKeys.detailPasngChrgeSm, vKakaoNoticeInfo.getDetailPasngChrgeSm());
|
|
||||||
payData.put(PayDataKeys.detailAdiPasngChrgeSm, vKakaoNoticeInfo.getDetailAdiPasngChrgeSm());
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> validateData(Map<String, Object> reqParam, Map<PayDataKeys, Object> payData) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
|
|
||||||
String userBirth = (String) reqData.getOrDefault("user_birth", "");
|
|
||||||
if (!userBirth.equals(payData.get(PayDataKeys.userBirth)))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, String.format("요청과 실제 생년월일이 일치하지 않습니다. (요청: %s 실제: %s)", userBirth, payData.get(PayDataKeys.userBirth)));
|
|
||||||
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private KkoPayNoticeRespData createRespData(TbInputDataXit tbInputDataXit, Map<PayDataKeys, Object> payData) {
|
|
||||||
|
|
||||||
Map<String, Object> detail = new HashMap<>();
|
|
||||||
detail.put("item_type", "TEXT");
|
|
||||||
detail.put("elements", Arrays.asList(String.format("상세 통행료: %s", payData.get(PayDataKeys.detailPasngChrgeSm))
|
|
||||||
, String.format("상세 부가통행료: %s", payData.get(PayDataKeys.detailAdiPasngChrgeSm))));
|
|
||||||
List<Map<String, Object>> details = Arrays.asList(detail);
|
|
||||||
|
|
||||||
return KkoPayNoticeRespData.builder()
|
|
||||||
.title(tbInputDataXit.getTbInputXit().getFsJob().getJobName())
|
|
||||||
.amount((Integer) payData.get(PayDataKeys.amount))
|
|
||||||
.expireType("D1")
|
|
||||||
.payExpireDate((String) payData.get(PayDataKeys.payExpireDate))
|
|
||||||
.details(details)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private KkoPayNoticeRespData loadRespData(Map<String, Object> data, KkoPayNoticeRespData kkoPayNoticeRespData) {
|
|
||||||
if (CmmnUtil.isEmpty(kkoPayNoticeRespData))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
data.put(DataKeys.kkoPayNoticeRespData.name(), kkoPayNoticeRespData);
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), gson.toJson(kkoPayNoticeRespData));
|
|
||||||
return kkoPayNoticeRespData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<KkoPayNoticeRespData> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
KkoPayNoticeRespData kkoPayNoticeRespData = (KkoPayNoticeRespData) data.get(DataKeys.kkoPayNoticeRespData.name());
|
|
||||||
return PayApiRespDTO.<KkoPayNoticeRespData>okBuilder()
|
|
||||||
.data(kkoPayNoticeRespData)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
String resCode = null;
|
|
||||||
String message = null;
|
|
||||||
switch (e.getErrCd()) {
|
|
||||||
case NO_DATA_FOUND:
|
|
||||||
resCode = PayUseSysResCd.NOT_FOUND_PAYDATA.getCode();
|
|
||||||
message = PayUseSysResCd.NOT_FOUND_PAYDATA.getCodeNm();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
resCode = PayUseSysResCd.PAYDATA_FIND_FAILED.getCode();
|
|
||||||
message = PayUseSysResCd.PAYDATA_FIND_FAILED.getCodeNm();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PayApiRespDTO.<KkoPayNoticeRespData>errBuilder()
|
|
||||||
.resCode(resCode)
|
|
||||||
.message(message)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.kakaoPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payNotice)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,191 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbKakaoPayResultRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayResultReqData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.PayUseSysApi;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayResultService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupKkoPayResultService implements PayResultService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final PayUseSysApi payUseSysApi;
|
|
||||||
private final TbKakaoPayResultRepository tbKakaoPayResultRepository;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
|
|
||||||
if (billerUserKey == null) billerUserKey = "";
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
|
|
||||||
final String url = fsJob.getBpKkoPayresultApi();
|
|
||||||
|
|
||||||
|
|
||||||
Optional.ofNullable(gson.fromJson(gson.toJson(reqParam.get("data")), KkoPayResultReqData.class))
|
|
||||||
.map(kkoPayResultReqData -> toEntity(kkoPayResultReqData))
|
|
||||||
.map(entity -> savePayResult(entity))
|
|
||||||
.map(entity -> tbInputDataXit)
|
|
||||||
.filter(detail -> "Y".equals(detail.getTbInputXit().getFsJob()))
|
|
||||||
.map(vKakaoNoticeInfoSn -> payUseSysApi.payResult(url, reqParam, null))
|
|
||||||
.map(response -> loadRespData(data, response))
|
|
||||||
.map(response -> checkResponse(response))
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbKakaoPayResult toEntity(KkoPayResultReqData kkoPayResultReqData) {
|
|
||||||
|
|
||||||
|
|
||||||
final String jobSe = "EL".equals(kkoPayResultReqData.getBillerUserKey().substring(0, 2)) ? "2" : "1";
|
|
||||||
|
|
||||||
|
|
||||||
final String payAmount = CmmnUtil.isEmpty(kkoPayResultReqData.getPayAmount()) ? null : String.valueOf(kkoPayResultReqData.getPayAmount());
|
|
||||||
final String payFee = CmmnUtil.isEmpty(kkoPayResultReqData.getPayFee()) ? null : String.valueOf(kkoPayResultReqData.getPayFee());
|
|
||||||
final String payFeeTax = CmmnUtil.isEmpty(kkoPayResultReqData.getPayFeeTax()) ? null : String.valueOf(kkoPayResultReqData.getPayFeeTax());
|
|
||||||
final String payId = CmmnUtil.isEmpty(kkoPayResultReqData.getPayId()) ? null : String.valueOf(kkoPayResultReqData.getPayId());
|
|
||||||
|
|
||||||
return TbKakaoPayResult.builder()
|
|
||||||
.dataId(kkoPayResultReqData.getBillerUserKey())
|
|
||||||
.jobSe(jobSe)
|
|
||||||
.payMn(kkoPayResultReqData.getPayBy())
|
|
||||||
.payTy(kkoPayResultReqData.getPayType())
|
|
||||||
.payDetail1(kkoPayResultReqData.getPayDetail1())
|
|
||||||
.payDetail2(kkoPayResultReqData.getPayDetail2())
|
|
||||||
.payDetail3(kkoPayResultReqData.getPayDetail3())
|
|
||||||
.payAmount(payAmount)
|
|
||||||
.payFeeTy(kkoPayResultReqData.getPayFeeType())
|
|
||||||
.payFeeAmount(payFee)
|
|
||||||
.payFeeVat(payFeeTax)
|
|
||||||
.excclcPrearngeDe(kkoPayResultReqData.getAdjustDate())
|
|
||||||
.payDt(kkoPayResultReqData.getPaidAt())
|
|
||||||
.payId(payId)
|
|
||||||
.payResultProcessSttus("0")
|
|
||||||
// .creatDt()
|
|
||||||
.crtr("ENS_SYS")
|
|
||||||
// .updtDt()
|
|
||||||
// .updusr()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbKakaoPayResult savePayResult(TbKakaoPayResult entity) {
|
|
||||||
tbKakaoPayResultRepository.save(entity);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResponseEntity<String> loadRespData(Map<String, Object> data, ResponseEntity<String> response) {
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), response.getBody());
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO<Map<String, Object>> checkResponse(ResponseEntity<String> response) {
|
|
||||||
|
|
||||||
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
||||||
throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
||||||
|
|
||||||
PayApiRespDTO<Map<String, Object>> result = null;
|
|
||||||
try {
|
|
||||||
result = gson.fromJson(response.getBody(), PayApiRespDTO.class);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_RESPONSE, EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<Map<String, Object>> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>okBuilder().build();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errDataBuilder()
|
|
||||||
.resCode(PayUseSysResCd.FAILED_SAVE_PAYRSLT.getCode())
|
|
||||||
.message(PayUseSysResCd.FAILED_SAVE_PAYRSLT.getCodeNm())
|
|
||||||
.data(null)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("biller_user_key");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.kakaoPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payResult)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,147 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.CustomUrl;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.service.process.model.KkoPayUrlRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayUrlService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupKkoPayUrlService implements PayUrlService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<KkoPayUrlRespData>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
|
||||||
@Value("${contract.kakao.pay.bill.dozn.api.validate.host}")
|
|
||||||
private String BILL_HOST;
|
|
||||||
@Value("${contract.kakao.pay.bill.dozn.api.validate.notice}")
|
|
||||||
private String BILL_NOTICE_URL;
|
|
||||||
@Value("${contract.kakao.pay.bill.dozn.api.validate.prepay}")
|
|
||||||
private String BILL_PREPAY_URL;
|
|
||||||
@Value("${contract.kakao.pay.bill.dozn.api.validate.payresult}")
|
|
||||||
private String BILL_PAYREUSLT_URL;
|
|
||||||
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
final String billerUserKey = (String) reqData.getOrDefault("billerUserKey", "");
|
|
||||||
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
Optional.ofNullable(createRespData(data))
|
|
||||||
.map(kkoPayUrlRespData -> loadRespData(data, kkoPayUrlRespData));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private KkoPayUrlRespData createRespData(Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
return KkoPayUrlRespData.builder()
|
|
||||||
.billedYearMonth(null)
|
|
||||||
.ordinal(null)
|
|
||||||
.expireAt(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
|
|
||||||
.parameters(null)
|
|
||||||
.customUrl(CustomUrl.builder()
|
|
||||||
.noticeUrl(this.BILL_HOST + this.BILL_NOTICE_URL)
|
|
||||||
.prepayUrl(this.BILL_HOST + this.BILL_PREPAY_URL)
|
|
||||||
.payResultUrl(this.BILL_HOST + this.BILL_PAYREUSLT_URL)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> loadRespData(Map<String, Object> data, KkoPayUrlRespData kkoPayUrlRespData) {
|
|
||||||
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), gson.toJson(kkoPayUrlRespData));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<KkoPayUrlRespData> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
KkoPayUrlRespData kkoPayUrlRespData = gson.fromJson((String) data.get(DataKeys.responseJsonStr.name()), KkoPayUrlRespData.class);
|
|
||||||
return PayApiRespDTO.<KkoPayUrlRespData>okBuilder()
|
|
||||||
.data(kkoPayUrlRespData)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return PayApiRespDTO.<KkoPayUrlRespData>errBuilder()
|
|
||||||
.resCode(PayUseSysResCd.GRNURL_FIND_FAILED.getCode())
|
|
||||||
.message(PayUseSysResCd.GRNURL_FIND_FAILED.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
final String billerUserKey = (String) reqData.getOrDefault("billerUserKey", "");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.kakaoPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.gnrUrl)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,224 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbEnfrcLevMastrRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.PayUseSysApi;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayAbleService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupNvPayAbleService implements PayAbleService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
|
|
||||||
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
|
|
||||||
private final TbEnfrcLevMastrRepository tbEnfrcLevMastrRepository;
|
|
||||||
private final PayUseSysApi payUseSysApi;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
payApiRespDTO,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("billerUserKey");
|
|
||||||
// String productName = (String) reqData.get("productName");
|
|
||||||
// Integer totalPayAmount = (Integer) reqData.get("totalPayAmount");
|
|
||||||
// Integer taxScopeAmount = (Integer) reqData.get("taxScopeAmount");
|
|
||||||
// Integer taxExScopeAmount = (Integer) reqData.get("taxExScopeAmount");
|
|
||||||
|
|
||||||
if (billerUserKey == null) billerUserKey = "";
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
final String dataId = tbInputDataXit.getDataId();
|
|
||||||
|
|
||||||
if ("Y".equals(fsJob.getBpEntrustYn()) || "y".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
|
|
||||||
final String url = fsJob.getBpNvPrepayApi();
|
|
||||||
|
|
||||||
VKakaoNoticeInfoSn vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId)
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 단순미납부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfoSn)
|
|
||||||
.map(entity -> payUseSysApi.payAble(url, reqParam, null))
|
|
||||||
.map(response -> checkResponse(response))
|
|
||||||
.map(payApiRespDTO -> loadRespData(data, payApiRespDTO))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "단순미납 응답데이터 수신에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else if ("N".equals(fsJob.getBpEntrustYn()) || "n".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
if (dataId.length() < 20)
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "데이터ID가 20자리 미만 입니다.");
|
|
||||||
VKakaoNoticeInfo vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 강제징수부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfo)
|
|
||||||
.map(entity -> validateData(reqParam, entity));
|
|
||||||
TbEnfrcLevMastr tbEnfrcLevMastr = tbEnfrcLevMastrRepository.findByEnfrcLevMastrIdAndEnfrcLevMastrProcessSttusAndDeleteAt(dataId.substring(0, 20), "04", "N")
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "납부가능 상태가 아닙니다.", PayUseSysResCd.NO_TARGET_PAYABLE));
|
|
||||||
Optional.of(tbEnfrcLevMastr)
|
|
||||||
.map(entity -> createRespData())
|
|
||||||
.map(payApiRespDTO -> loadRespData(data, payApiRespDTO))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "강제징수 응답데이터 생성에 실패했습니다."));
|
|
||||||
} else {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "위탁여부가 등록되지 않았습니다.");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO<Map<String, Object>> checkResponse(ResponseEntity<String> response) {
|
|
||||||
|
|
||||||
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
||||||
throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
||||||
|
|
||||||
PayApiRespDTO<Map<String, Object>> result = null;
|
|
||||||
try {
|
|
||||||
result = gson.fromJson(response.getBody(), PayApiRespDTO.class);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_RESPONSE, EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO loadRespData(Map<String, Object> data, PayApiRespDTO payApiRespDTO) {
|
|
||||||
if (CmmnUtil.isEmpty(payApiRespDTO))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
data.put(DataKeys.payApiRespDTO.name(), payApiRespDTO);
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), gson.toJson(payApiRespDTO));
|
|
||||||
return payApiRespDTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
private VKakaoNoticeInfo validateData(Map<String, Object> reqParam, VKakaoNoticeInfo vKakaoNoticeInfo) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
|
|
||||||
final String productName = (String) reqData.get("productName");
|
|
||||||
final Integer totalPayAmount = (Integer) reqData.getOrDefault("totalPayAmount", 0);
|
|
||||||
final Integer taxScopeAmount = (Integer) reqData.get("taxScopeAmount");
|
|
||||||
final Integer taxExScopeAmount = (Integer) reqData.get("taxExScopeAmount");
|
|
||||||
|
|
||||||
|
|
||||||
if (totalPayAmount != Integer.parseInt(vKakaoNoticeInfo.getAmount()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, String.format("납부 가능 금액이 없거나 일치하지 않습니다. (요청금액:%s, 실제금액:%s)", totalPayAmount, vKakaoNoticeInfo.getAmount())
|
|
||||||
, PayUseSysResCd.NO_AMOUNT_PAYABLE);
|
|
||||||
if (totalPayAmount > Integer.parseInt(vKakaoNoticeInfo.getAmount()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, String.format("납부 가능 금액을 초과했습니다. (요청금액:%s, 실제금액:%s)", totalPayAmount, vKakaoNoticeInfo.getAmount())
|
|
||||||
, PayUseSysResCd.OVERPAYABLE_AMOUNT);
|
|
||||||
if (CmmnUtil.isEmpty(vKakaoNoticeInfo.getPayExpireDate()))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, "납부기한의 값이 비어있습니다."
|
|
||||||
, PayUseSysResCd.EXPIRED_DATE);
|
|
||||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
||||||
if (Integer.parseInt(vKakaoNoticeInfo.getPayExpireDate()) < Integer.parseInt(simpleDateFormat.format(new Date())))
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA
|
|
||||||
, "납부기한이 경과한 자료 입니다."
|
|
||||||
, PayUseSysResCd.EXPIRED_DATE);
|
|
||||||
|
|
||||||
return vKakaoNoticeInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO<Map<String, Object>> createRespData() {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>okBuilder().build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<Map<String, Object>> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
PayApiRespDTO<Map<String, Object>> payApiRespDTO = (PayApiRespDTO<Map<String, Object>>) data.get(DataKeys.payApiRespDTO.name());
|
|
||||||
return payApiRespDTO;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
if (e.getData() != null && e.getData() instanceof PayUseSysResCd) {
|
|
||||||
PayUseSysResCd resCode = (PayUseSysResCd) e.getData();
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errBuilder()
|
|
||||||
.resCode(resCode.getCode())
|
|
||||||
.message(resCode.getCodeNm())
|
|
||||||
.build();
|
|
||||||
} else {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errBuilder()
|
|
||||||
.resCode(PayUseSysResCd.FAILED_CHECK_INFO.getCode())
|
|
||||||
.message(PayUseSysResCd.FAILED_CHECK_INFO.getCodeNm())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
String billerUserKey = (String) reqData.get("billerUserKey");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.naverPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payAble)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.utils.MapDeserailizer;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.entity.BillNvEasyPay;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayCancelService;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.model.PayCancelData;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupNvPayCancelService implements PayCancelService<PayCancelData<BillNvEasyPay>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
|
|
||||||
private Gson gson = new GsonBuilder().registerTypeAdapter(Map.class, new MapDeserailizer()).create();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayCancelData<BillNvEasyPay> getData(Map<String, Object> reqParam) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, PayCancelData<BillNvEasyPay> data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, PayCancelData<BillNvEasyPay> data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<Map<String, Object>> generateResult(Map<String, Object> reqParam, PayCancelData<BillNvEasyPay> data, EnsException e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, PayCancelData<BillNvEasyPay> data, EnsException e) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,229 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.VKakaoNoticeInfoSnRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.code.NvEpCtgyIdCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.model.NvPayNoticeRespData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.model.config.notice.ProductItem;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayNoticeService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupNvPayNoticeService implements PayNoticeService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<NvPayNoticeRespData>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final VKakaoNoticeInfoSnRepository vKakaoNoticeInfoSnRepository;
|
|
||||||
private final VKakaoNoticeInfoRepository vKakaoNoticeInfoRepository;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
@Value("${contract.naver.pay.easy.api.validate.host}")
|
|
||||||
private String BILL_HOST;
|
|
||||||
@Value("${contract.naver.pay.easy.api.validate.prepay}")
|
|
||||||
private String BILL_PAYABLE_URL;
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
nvPayNoticeRespData,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum PayDataKeys {
|
|
||||||
billerUserKey,
|
|
||||||
userBirth,
|
|
||||||
amount,
|
|
||||||
payExpireDate,
|
|
||||||
detailPasngChrgeSm,
|
|
||||||
detailAdiPasngChrgeSm,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
final String billerUserKey = (String) reqData.getOrDefault("billerUserKey", "");
|
|
||||||
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
final String dataId = tbInputDataXit.getDataId();
|
|
||||||
|
|
||||||
if ("Y".equals(fsJob.getBpEntrustYn()) || "y".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
VKakaoNoticeInfoSn vKakaoNoticeInfoSn = vKakaoNoticeInfoSnRepository.findById(dataId)
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 단순미납부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfoSn)
|
|
||||||
.map(entity -> toDataMap(entity))
|
|
||||||
.map(payData -> validateData(reqParam, payData))
|
|
||||||
.map(payData -> createRespData(tbInputDataXit, payData))
|
|
||||||
.map(kkoPayNoticeRespData -> loadRespData(data, kkoPayNoticeRespData))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "단순미납 응답데이터 생성에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else if ("N".equals(fsJob.getBpEntrustYn()) || "n".equals(fsJob.getBpEntrustYn())) {
|
|
||||||
if (dataId.length() < 20)
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "데이터ID가 20자리 미만 입니다.");
|
|
||||||
VKakaoNoticeInfo vKakaoNoticeInfo = vKakaoNoticeInfoRepository.findById(dataId.substring(0, 20))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.NO_DATA_FOUND, "일치하는 강제징수부과 자료가 없습니다."));
|
|
||||||
Optional.of(vKakaoNoticeInfo)
|
|
||||||
.map(entity -> toDataMap(entity))
|
|
||||||
.map(map -> validateData(reqParam, map))
|
|
||||||
.map(map -> createRespData(tbInputDataXit, map))
|
|
||||||
.map(kkoPayNoticeRespData -> loadRespData(data, kkoPayNoticeRespData))
|
|
||||||
.orElseThrow(() -> new EnsException(EnsErrCd.FAILED_CREATE_RESPONSE_DATA, "강제징수 응답데이터 생성에 실패했습니다."))
|
|
||||||
;
|
|
||||||
} else {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_DATA, "위탁여부가 등록되지 않았습니다.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> toDataMap(VKakaoNoticeInfoSn vKakaoNoticeInfoSn) {
|
|
||||||
Map<PayDataKeys, Object> payData = new HashMap<>();
|
|
||||||
payData.put(PayDataKeys.billerUserKey, vKakaoNoticeInfoSn.getDataId());
|
|
||||||
payData.put(PayDataKeys.userBirth, vKakaoNoticeInfoSn.getUserBirth());
|
|
||||||
payData.put(PayDataKeys.amount, vKakaoNoticeInfoSn.getAmount().intValue());
|
|
||||||
payData.put(PayDataKeys.payExpireDate, vKakaoNoticeInfoSn.getPayExpireDate());
|
|
||||||
payData.put(PayDataKeys.detailPasngChrgeSm, vKakaoNoticeInfoSn.getDetailPasngChrgeSm());
|
|
||||||
payData.put(PayDataKeys.detailAdiPasngChrgeSm, vKakaoNoticeInfoSn.getDetailAdiPasngChrgeSm());
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> toDataMap(VKakaoNoticeInfo vKakaoNoticeInfo) {
|
|
||||||
Map<PayDataKeys, Object> payData = new HashMap<>();
|
|
||||||
payData.put(PayDataKeys.billerUserKey, vKakaoNoticeInfo.getEnfrcLevMastrId());
|
|
||||||
payData.put(PayDataKeys.userBirth, vKakaoNoticeInfo.getUserBirth());
|
|
||||||
payData.put(PayDataKeys.amount, Integer.parseInt(vKakaoNoticeInfo.getAmount()));
|
|
||||||
payData.put(PayDataKeys.payExpireDate, vKakaoNoticeInfo.getPayExpireDate());
|
|
||||||
payData.put(PayDataKeys.detailPasngChrgeSm, vKakaoNoticeInfo.getDetailPasngChrgeSm());
|
|
||||||
payData.put(PayDataKeys.detailAdiPasngChrgeSm, vKakaoNoticeInfo.getDetailAdiPasngChrgeSm());
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<PayDataKeys, Object> validateData(Map<String, Object> reqParam, Map<PayDataKeys, Object> payData) {
|
|
||||||
return payData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private NvPayNoticeRespData createRespData(TbInputDataXit tbInputDataXit, Map<PayDataKeys, Object> payData) {
|
|
||||||
NvEpCtgyIdCd productSe = NvEpCtgyIdCd.ETC_ETC;
|
|
||||||
List<ProductItem> productItems = Arrays.asList(ProductItem.builder()
|
|
||||||
.categoryType(productSe.getCategoryTypeCd())
|
|
||||||
.categoryId(productSe.getCode().split("_")[1])
|
|
||||||
// .uid(tbInputDataXit.getLinkedUuid())
|
|
||||||
.uid(tbInputDataXit.getTbInputXit().getFsJob().getJobCd()) //2023.03.14 네이버페이 검수 결과 - 상품고유ID로 변경
|
|
||||||
.name(tbInputDataXit.getTbInputXit().getFsJob().getJobName())
|
|
||||||
.count(1)
|
|
||||||
.build());
|
|
||||||
Integer productCount = productItems.stream().map(productItem -> productItem.getCount()).reduce(Integer::sum).get();
|
|
||||||
return NvPayNoticeRespData.builder()
|
|
||||||
.productName(tbInputDataXit.getTbInputXit().getFsJob().getJobName())
|
|
||||||
.productCount(productCount)
|
|
||||||
.totalPayAmount((Integer) payData.get(PayDataKeys.amount))
|
|
||||||
.taxScopeAmount((Integer) payData.get(PayDataKeys.amount))
|
|
||||||
.taxExScopeAmount(0)
|
|
||||||
.environmentDepositAmount(0)
|
|
||||||
.productItems(productItems)
|
|
||||||
.returnUrl(this.BILL_HOST + this.BILL_PAYABLE_URL)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private NvPayNoticeRespData loadRespData(Map<String, Object> data, NvPayNoticeRespData kkoPayNoticeRespData) {
|
|
||||||
if (CmmnUtil.isEmpty(kkoPayNoticeRespData))
|
|
||||||
return null;
|
|
||||||
|
|
||||||
data.put(DataKeys.nvPayNoticeRespData.name(), kkoPayNoticeRespData);
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), gson.toJson(kkoPayNoticeRespData));
|
|
||||||
return kkoPayNoticeRespData;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<NvPayNoticeRespData> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
NvPayNoticeRespData nvPayNoticeRespData = (NvPayNoticeRespData) data.get(DataKeys.nvPayNoticeRespData.name());
|
|
||||||
return PayApiRespDTO.<NvPayNoticeRespData>okBuilder()
|
|
||||||
.data(nvPayNoticeRespData)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
String resCode = null;
|
|
||||||
String message = null;
|
|
||||||
switch (e.getErrCd()) {
|
|
||||||
case NO_DATA_FOUND:
|
|
||||||
resCode = PayUseSysResCd.NOT_FOUND_PAYDATA.getCode();
|
|
||||||
message = PayUseSysResCd.NOT_FOUND_PAYDATA.getCodeNm();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
resCode = PayUseSysResCd.PAYDATA_FIND_FAILED.getCode();
|
|
||||||
message = PayUseSysResCd.PAYDATA_FIND_FAILED.getCodeNm();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PayApiRespDTO.<NvPayNoticeRespData>errBuilder()
|
|
||||||
.resCode(resCode)
|
|
||||||
.message(message)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> reqData = (Map<String, Object>) reqParam.getOrDefault("data", new HashMap<>());
|
|
||||||
final String billerUserKey = (String) reqData.getOrDefault("billerUserKey", "");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.naverPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payNotice)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,212 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.service.process;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.*;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbIupBillPayHistRepository;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.repository.TbNaverPayResultRepository;
|
|
||||||
import cokr.xit.ens.core.exception.EnsException;
|
|
||||||
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
|
||||||
import cokr.xit.ens.core.utils.CmmnUtil;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.model.NvPayResultDetail;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.nv.service.process.model.NvPayResultReqData;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.api.PayUseSysApi;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PaidTypeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysHisSeCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.PayUseSysResCd;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.model.PayApiRespDTO;
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.service.process.kit.PayResultService;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Service
|
|
||||||
public class IupNvPayResultService implements PayResultService<Map<String, Object>, Map<String, Object>, PayApiRespDTO<Map<String, Object>>> {
|
|
||||||
|
|
||||||
private final JPAQueryFactory query;
|
|
||||||
private final PayUseSysApi payUseSysApi;
|
|
||||||
private final TbNaverPayResultRepository tbNaverPayResultRepository;
|
|
||||||
private final TbIupBillPayHistRepository tbIupBillPayHistRepository;
|
|
||||||
|
|
||||||
private Gson gson = new Gson();
|
|
||||||
|
|
||||||
private enum DataKeys {
|
|
||||||
tbInputDataXit,
|
|
||||||
responseJsonStr,
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> getData(Map<String, Object> reqParam) {
|
|
||||||
Map<String, Object> body = (Map<String, Object>) reqParam.getOrDefault("body", new HashMap<>());
|
|
||||||
Map<String, Object> detail = (Map<String, Object>) body.getOrDefault("detail", new HashMap<>());
|
|
||||||
String billerUserKey = (String) detail.get("merchantUserKey");
|
|
||||||
|
|
||||||
if (billerUserKey == null) billerUserKey = "";
|
|
||||||
TbInputDataXit tbInputDataXit = query.selectFrom(QTbInputDataXit.tbInputDataXit)
|
|
||||||
.innerJoin(QTbInputDataXit.tbInputDataXit.tbInputXit, QTbInputXit.tbInputXit).fetchJoin()
|
|
||||||
.innerJoin(QTbInputXit.tbInputXit.fsJob, QFsJob.fsJob).fetchJoin()
|
|
||||||
.where(QTbInputDataXit.tbInputDataXit.linkedUuid.eq(billerUserKey))
|
|
||||||
.fetchOne();
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>();
|
|
||||||
data.put(DataKeys.tbInputDataXit.name(), tbInputDataXit);
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void validate(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
|
|
||||||
if (CmmnUtil.isEmpty(data.get(DataKeys.tbInputDataXit.name())))
|
|
||||||
throw new EnsException(EnsErrCd.NO_DATA_FOUND, EnsErrCd.NO_DATA_FOUND.getCodeNm());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void callApi(Map<String, Object> reqParam, Map<String, Object> data) {
|
|
||||||
TbInputDataXit tbInputDataXit = (TbInputDataXit) data.get(DataKeys.tbInputDataXit.name());
|
|
||||||
TbInputXit tbInputXit = tbInputDataXit.getTbInputXit();
|
|
||||||
FsJob fsJob = tbInputXit.getFsJob();
|
|
||||||
|
|
||||||
final String url = fsJob.getBpKkoPayresultApi();
|
|
||||||
|
|
||||||
Optional.ofNullable(gson.fromJson(gson.toJson(reqParam.get("body")), NvPayResultReqData.class))
|
|
||||||
.map(nvPayResultReqData -> toEntity(nvPayResultReqData))
|
|
||||||
.map(entity -> savePayResult(entity))
|
|
||||||
.map(entity -> tbInputDataXit)
|
|
||||||
.filter(detail -> "Y".equals(detail.getTbInputXit().getFsJob()))
|
|
||||||
.map(vKakaoNoticeInfoSn -> payUseSysApi.payResult(url, reqParam, null))
|
|
||||||
.map(respnose -> loadRespData(data, respnose))
|
|
||||||
.map(response -> checkResponse(response))
|
|
||||||
;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbNaverPayResult toEntity(NvPayResultReqData nvPayResultReqData) {
|
|
||||||
NvPayResultDetail detail = nvPayResultReqData.getDetail();
|
|
||||||
final String billerUserKey = detail.getMerchantUserKey();
|
|
||||||
|
|
||||||
|
|
||||||
final String jobSe = "EL".equals(billerUserKey.substring(0, 2)) ? "2" : "1";
|
|
||||||
|
|
||||||
|
|
||||||
return TbNaverPayResult.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.jobSe(jobSe)
|
|
||||||
.paymentId(detail.getPaymentId())
|
|
||||||
.payHistId(detail.getPayHistId())
|
|
||||||
.merchantId(detail.getMerchantId())
|
|
||||||
.merchantName(detail.getMerchantName())
|
|
||||||
.merchantPayKey(detail.getMerchantPayKey())
|
|
||||||
.merchantUserKey(detail.getMerchantUserKey())
|
|
||||||
.admissionTypeCode(detail.getAdmissionTypeCode())
|
|
||||||
.admissionYmdt(detail.getAdmissionYmdt())
|
|
||||||
.tradeConfirmYmdt(detail.getTradeConfirmYmdt())
|
|
||||||
.admissionState(detail.getAdmissionState())
|
|
||||||
.totalPayAmount(detail.getTotalPayAmount())
|
|
||||||
.primaryPayAmount(detail.getPrimaryPayAmount())
|
|
||||||
.npointPayAmount(detail.getNpointPayAmount())
|
|
||||||
.giftCardAmount(detail.getGiftCardAmount())
|
|
||||||
.taxScopeAmount(detail.getTaxScopeAmount())
|
|
||||||
.taxExScopeAmount(detail.getTaxExScopeAmount())
|
|
||||||
.environmentDepositAmount(detail.getEnvironmentDepositAmount())
|
|
||||||
.primaryPayMeans(detail.getPrimaryPayMeans())
|
|
||||||
.cardCorpCode(detail.getCardCorpCode())
|
|
||||||
.cardNo(detail.getCardNo())
|
|
||||||
.cardAuthNo(detail.getCardAuthNo())
|
|
||||||
.cardInstCount(detail.getCardInstCount())
|
|
||||||
.usedCardPoint(detail.getUsedCardPoint())
|
|
||||||
.bankCorpCode(detail.getBankCorpCode())
|
|
||||||
.bankAccountNo(detail.getBankAccountNo())
|
|
||||||
.productName(detail.getProductName())
|
|
||||||
.settleExpected(detail.getSettleExpected())
|
|
||||||
.settleExpectAmount(detail.getSettleExpectAmount())
|
|
||||||
.payCommissionAmount(detail.getPayCommissionAmount())
|
|
||||||
.extraDeduction(detail.getExtraDeduction())
|
|
||||||
.useCfmYmdt(detail.getUseCfmYmdt())
|
|
||||||
.merchantExtraParameter(detail.getMerchantExtraParameter())
|
|
||||||
.userIdentifier(detail.getUserIdentifier())
|
|
||||||
.payResultProcessSttus("0")
|
|
||||||
// .creatDt()
|
|
||||||
.crtr("ENS_SYS")
|
|
||||||
// .updtDt()
|
|
||||||
// .updusr()
|
|
||||||
.build();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private TbNaverPayResult savePayResult(TbNaverPayResult entity) {
|
|
||||||
tbNaverPayResultRepository.save(entity);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ResponseEntity<String> loadRespData(Map<String, Object> data, ResponseEntity<String> response) {
|
|
||||||
data.put(DataKeys.responseJsonStr.name(), response.getBody());
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PayApiRespDTO<Map<String, Object>> checkResponse(ResponseEntity<String> response) {
|
|
||||||
|
|
||||||
if (!HttpStatus.OK.equals(response.getStatusCode()))
|
|
||||||
throw new EnsException(EnsErrCd.API_COMM_ERROR, EnsErrCd.API_COMM_ERROR.getCodeNm() + " " + response.getStatusCode().toString(), response.getBody());
|
|
||||||
|
|
||||||
PayApiRespDTO<Map<String, Object>> result = null;
|
|
||||||
try {
|
|
||||||
result = gson.fromJson(response.getBody(), PayApiRespDTO.class);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
throw new EnsException(EnsErrCd.INVALID_RESPONSE, EnsErrCd.INVALID_RESPONSE.getCodeNm(), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PayApiRespDTO<Map<String, Object>> generateResult(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
if (e == null) {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>okBuilder().build();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return PayApiRespDTO.<Map<String, Object>>errDataBuilder()
|
|
||||||
.resCode(PayUseSysResCd.FAILED_SAVE_PAYRSLT.getCode())
|
|
||||||
.message(PayUseSysResCd.FAILED_SAVE_PAYRSLT.getCodeNm())
|
|
||||||
.data(null)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void saveHist(Map<String, Object> reqParam, Map<String, Object> data, EnsException e) {
|
|
||||||
Map<String, Object> body = (Map<String, Object>) reqParam.getOrDefault("body", new HashMap<>());
|
|
||||||
Map<String, Object> detail = (Map<String, Object>) body.getOrDefault("detail", new HashMap<>());
|
|
||||||
String billerUserKey = (String) detail.get("merchantUserKey");
|
|
||||||
|
|
||||||
String errorCode = null;
|
|
||||||
String errorMessage = null;
|
|
||||||
if (e != null) {
|
|
||||||
errorCode = e.getErrCd().getCode();
|
|
||||||
errorMessage = String.format("%s %s", e.getMessage(), CmmnUtil.printStackTraceToString(e));
|
|
||||||
}
|
|
||||||
|
|
||||||
TbIupBillPayHist tbIupBillPayHist = TbIupBillPayHist.builder()
|
|
||||||
.dataId(billerUserKey)
|
|
||||||
.paidType(PaidTypeCd.naverPay)
|
|
||||||
.hisSeCd(PayUseSysHisSeCd.payResult)
|
|
||||||
.requestData(gson.toJson(reqParam))
|
|
||||||
.responseData((String) data.get(DataKeys.responseJsonStr.name()))
|
|
||||||
.error(FieldError.initBuilder()
|
|
||||||
.errorCode(errorCode)
|
|
||||||
.errorMessage(errorMessage)
|
|
||||||
.build())
|
|
||||||
.build();
|
|
||||||
tbIupBillPayHistRepository.save(tbIupBillPayHist);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.domain;
|
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.BillHistPayUseSysBaseEntity;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.ToString;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table(name = "tb_iup_bill_pay_hist", schema = "", catalog = "", indexes = {
|
|
||||||
@Index(name = "idx_iup_bp_his_01", columnList = "data_id")
|
|
||||||
})
|
|
||||||
|
|
||||||
public class TbIupBillPayHist extends BillHistPayUseSysBaseEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
@Column(name = "id", nullable = false)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "data_id", nullable = true)
|
|
||||||
private String dataId;
|
|
||||||
|
|
||||||
}
|
|
@ -1,159 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.domain;
|
|
||||||
|
|
||||||
import cokr.xit.ens.core.jpa.support.BooleanToYnConverter;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
import org.hibernate.annotations.CreationTimestamp;
|
|
||||||
import org.hibernate.annotations.UpdateTimestamp;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
//@Data
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
@Builder
|
|
||||||
@EqualsAndHashCode
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table(name = "tb_naver_pay_result", schema = "", catalog = "")
|
|
||||||
public class TbNaverPayResult {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "data_id", length = 30)
|
|
||||||
private String dataId;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "job_se", length = 1, nullable = true)
|
|
||||||
private String jobSe;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "payment_id", length = 50)
|
|
||||||
private String paymentId;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "pay_hist_id", length = 50)
|
|
||||||
private String payHistId;
|
|
||||||
|
|
||||||
@Column(name = "merchant_id", length = 50)
|
|
||||||
private String merchantId;
|
|
||||||
|
|
||||||
@Column(name = "merchant_name", length = 50)
|
|
||||||
private String merchantName;
|
|
||||||
|
|
||||||
@Column(name = "merchant_pay_key", length = 64)
|
|
||||||
private String merchantPayKey;
|
|
||||||
|
|
||||||
@Column(name = "merchant_user_key", length = 50)
|
|
||||||
private String merchantUserKey;
|
|
||||||
|
|
||||||
@Column(name = "admission_type_code", length = 2)
|
|
||||||
private String admissionTypeCode;
|
|
||||||
|
|
||||||
@Column(name = "admission_ymdt", length = 14)
|
|
||||||
private String admissionYmdt;
|
|
||||||
|
|
||||||
@Column(name = "trade_confirm_ymdt", length = 50)
|
|
||||||
private String tradeConfirmYmdt;
|
|
||||||
|
|
||||||
@Column(name = "admission_state", length = 10)
|
|
||||||
private String admissionState;
|
|
||||||
|
|
||||||
@Column(name = "total_pay_amount")
|
|
||||||
private Integer totalPayAmount;
|
|
||||||
|
|
||||||
@Column(name = "primary_pay_amount")
|
|
||||||
private Integer primaryPayAmount;
|
|
||||||
|
|
||||||
@Column(name = "npoint_pay_amount")
|
|
||||||
private Integer npointPayAmount;
|
|
||||||
|
|
||||||
@Column(name = "gift_card_amount")
|
|
||||||
private Integer giftCardAmount;
|
|
||||||
|
|
||||||
@Column(name = "tax_scope_amount")
|
|
||||||
private Integer taxScopeAmount;
|
|
||||||
|
|
||||||
@Column(name = "tax_ex_scope_amount")
|
|
||||||
private Integer taxExScopeAmount;
|
|
||||||
|
|
||||||
@Column(name = "environment_deposit_amount")
|
|
||||||
private Integer environmentDepositAmount;
|
|
||||||
|
|
||||||
@Column(name = "primary_pay_means", length = 10)
|
|
||||||
private String primaryPayMeans;
|
|
||||||
|
|
||||||
@Column(name = "card_corp_code", length = 10)
|
|
||||||
private String cardCorpCode;
|
|
||||||
|
|
||||||
@Column(name = "card_no", length = 50)
|
|
||||||
private String cardNo;
|
|
||||||
|
|
||||||
@Column(name = "card_auth_no", length = 30)
|
|
||||||
private String cardAuthNo;
|
|
||||||
|
|
||||||
@Column(name = "card_inst_count")
|
|
||||||
private Integer cardInstCount;
|
|
||||||
|
|
||||||
@Column(name = "used_card_point", length = 1)
|
|
||||||
@Convert(converter = BooleanToYnConverter.class)
|
|
||||||
private Boolean usedCardPoint;
|
|
||||||
|
|
||||||
@Column(name = "bank_corp_code", length = 10)
|
|
||||||
private String bankCorpCode;
|
|
||||||
|
|
||||||
@Column(name = "bank_account_no", length = 50)
|
|
||||||
private String bankAccountNo;
|
|
||||||
|
|
||||||
@Column(name = "product_name", length = 128)
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
@Column(name = "settle_expected", length = 1)
|
|
||||||
@Convert(converter = BooleanToYnConverter.class)
|
|
||||||
private Boolean settleExpected;
|
|
||||||
|
|
||||||
@Column(name = "settle_expect_amount")
|
|
||||||
private Integer settleExpectAmount;
|
|
||||||
|
|
||||||
@Column(name = "pay_commission_amount")
|
|
||||||
private Integer payCommissionAmount;
|
|
||||||
|
|
||||||
@Column(name = "extra_deduction", length = 1)
|
|
||||||
@Convert(converter = BooleanToYnConverter.class)
|
|
||||||
private Boolean extraDeduction;
|
|
||||||
|
|
||||||
@Column(name = "use_cfm_ymdt", length = 8)
|
|
||||||
private String useCfmYmdt;
|
|
||||||
|
|
||||||
@Column(name = "merchant_extra_parameter", length = 400)
|
|
||||||
private String merchantExtraParameter;
|
|
||||||
|
|
||||||
@Column(name = "user_identifier", length = 28)
|
|
||||||
private String userIdentifier;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "pay_result_process_sttus", length = 1, nullable = true)
|
|
||||||
private String payResultProcessSttus;
|
|
||||||
|
|
||||||
|
|
||||||
@CreationTimestamp
|
|
||||||
@Column(name = "creat_dt", nullable = true)
|
|
||||||
private LocalDateTime creatDt;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "crtr", length = 50, nullable = true)
|
|
||||||
private String crtr;
|
|
||||||
|
|
||||||
|
|
||||||
@UpdateTimestamp
|
|
||||||
@Column(name = "updt_dt", nullable = true)
|
|
||||||
private LocalDateTime updtDt;
|
|
||||||
|
|
||||||
|
|
||||||
@Column(name = "updusr", length = 50, nullable = true)
|
|
||||||
private String updusr;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,5 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
public interface TbEnfrcLevRcivRepositoryCustom {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TbEnfrcLevRcivRepositoryImpl implements TbEnfrcLevRcivRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory query;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,9 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.domain.repository;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.TbIupBillPayHist;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
|
|
||||||
public interface TbIupBillPayHistRepository extends JpaRepository<TbIupBillPayHist, Long> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package cokr.xit.ens.biz.iup.domain.repository;
|
|
||||||
|
|
||||||
import cokr.xit.ens.biz.iup.domain.TbKakaoPayResult;
|
|
||||||
import cokr.xit.ens.biz.iup.domain.TbNaverPayResult;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface TbNaverPayResultRepository extends JpaRepository<TbNaverPayResult, String> {
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,5 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
public interface VKakaoNoticeInfoRepositoryCustom {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class VKakaoNoticeInfoRepositoryImpl implements VKakaoNoticeInfoRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory query;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
public interface VKakaoNoticeInfoSnRepositoryCustom {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package cokr.xit.ens.biz.iup.domain.repository;
|
||||||
|
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class VKakaoNoticeInfoSnRepositoryImpl implements VKakaoNoticeInfoSnRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory query;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,14 +0,0 @@
|
|||||||
package cokr.xit.ens.core.config;
|
|
||||||
|
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
|
||||||
|
|
||||||
@EnableWebSecurity
|
|
||||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
|
||||||
http.csrf().disable();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
package cokr.xit.ens.core.jpa.dialect;
|
package cokr.xit.ens.core.dialect;
|
||||||
|
|
||||||
import org.hibernate.dialect.MariaDB103Dialect;
|
import org.hibernate.dialect.MariaDB103Dialect;
|
||||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
import org.hibernate.dialect.function.StandardSQLFunction;
|
@ -1,4 +1,4 @@
|
|||||||
package cokr.xit.ens.core.jpa.dialect;
|
package cokr.xit.ens.core.dialect;
|
||||||
|
|
||||||
import org.hibernate.dialect.Oracle10gDialect;
|
import org.hibernate.dialect.Oracle10gDialect;
|
||||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
import org.hibernate.dialect.function.StandardSQLFunction;
|
@ -1,18 +0,0 @@
|
|||||||
package cokr.xit.ens.core.jpa.support;
|
|
||||||
|
|
||||||
import javax.persistence.AttributeConverter;
|
|
||||||
import javax.persistence.Converter;
|
|
||||||
|
|
||||||
@Converter
|
|
||||||
public class BooleanToYnConverter implements AttributeConverter<Boolean, String> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String convertToDatabaseColumn(Boolean attribute) {
|
|
||||||
return (attribute != null && attribute) ? "Y" : "N";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean convertToEntityAttribute(String yn) {
|
|
||||||
return "Y".equalsIgnoreCase(yn);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
package cokr.xit.ens.core.model;
|
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.BillSeCd;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAlias;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.hibernate.validator.constraints.Length;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
|
|
||||||
@Builder
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Schema(name = "EnsBillAcptReqDTO")
|
|
||||||
public class EnsBillAcptReqDTO {
|
|
||||||
|
|
||||||
// @NotNull(message = "청구서ID 사용 여부는 필수 입력값 입니다.")
|
|
||||||
// @Schema(hidden = true, required = true, title = "청구서ID 사용 여부", example = "false")
|
|
||||||
// private Boolean use_bill_uid;
|
|
||||||
|
|
||||||
@Schema(hidden = true, required = false, title = "청구서 유니크ID", example = " ")
|
|
||||||
@JsonProperty("billUid")
|
|
||||||
@JsonAlias({"bill_uid"})
|
|
||||||
@SerializedName(value = "billUid", alternate = {"bill_uid"})
|
|
||||||
private String billUid;
|
|
||||||
|
|
||||||
@NotNull(message = "청구서 타입은 필수 입력값 입니다.")
|
|
||||||
@Schema(required = true, title = "청구서 타입", example = "all")
|
|
||||||
@JsonProperty("billSe")
|
|
||||||
@JsonAlias({"bill_se"})
|
|
||||||
@SerializedName(value = "billSe", alternate = {"bill_se"})
|
|
||||||
private BillSeCd billSe;
|
|
||||||
|
|
||||||
@NotBlank(message = "빌러유저키는 필수 입력값 입니다.")
|
|
||||||
@Length(max = 40, message = "빌러유저키의 최대 길이를 초과 했습니다.")
|
|
||||||
@Schema(required = true, title = "기관에서 관리하는 해당 고객번호 혹은 계약번호", example = " ")
|
|
||||||
@JsonProperty("billerUserKey")
|
|
||||||
@JsonAlias({"biller_user_key"})
|
|
||||||
@SerializedName(value = "billerUserKey", alternate = {"biller_user_key"})
|
|
||||||
private String billerUserKey;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,112 +1,112 @@
|
|||||||
package cokr.xit.ens.core.utils;
|
package cokr.xit.ens.core.utils;
|
||||||
|
|
||||||
import com.auth0.jwt.JWT;
|
|
||||||
import com.auth0.jwt.algorithms.Algorithm;
|
|
||||||
import com.auth0.jwt.interfaces.Claim;
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
import java.util.Base64.Decoder;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Base64.Decoder;
|
||||||
|
|
||||||
@Getter
|
import org.springframework.util.StringUtils;
|
||||||
public class JwtUtil {
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public final static String DEFAULT_SECRET_KEY = "czovL3d3dy50ZXN0LmNvLmtyIiwicm9sZX";
|
|
||||||
|
|
||||||
private String token;
|
|
||||||
|
|
||||||
private String header;
|
|
||||||
private String payload;
|
|
||||||
|
|
||||||
private boolean isCertified = false;
|
|
||||||
private Map<String, Claim> claims;
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Builder(builderClassName = "createBuilder", builderMethodName = "createBuilder")
|
|
||||||
public JwtUtil(String secretKey, String iss, String sub, String aud, Date exp, Date nbf, Date iat, String jti, String uUuid, String[] roles) {
|
|
||||||
if (StringUtils.isEmpty(secretKey))
|
|
||||||
throw new RuntimeException("SecretKey(은)는 필수조건 입니다.");
|
|
||||||
|
|
||||||
this.token = JWT.create()
|
|
||||||
.withIssuer(iss)
|
|
||||||
.withSubject(sub)
|
|
||||||
.withAudience(aud)
|
|
||||||
.withExpiresAt(exp)
|
|
||||||
.withNotBefore(nbf)
|
|
||||||
.withIssuedAt(iat)
|
|
||||||
.withJWTId(jti)
|
|
||||||
.withClaim("uUuid", uUuid)
|
|
||||||
.withArrayClaim("roles", roles)
|
|
||||||
.sign(Algorithm.HMAC512(secretKey.getBytes()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Builder(builderClassName = "decodeBuilder", builderMethodName = "decodeBuilder")
|
|
||||||
public JwtUtil(String jwt) {
|
|
||||||
|
|
||||||
Decoder decoder = Base64.getDecoder();
|
|
||||||
final String[] splitJwt = jwt.split("\\.");
|
|
||||||
this.token = jwt;
|
|
||||||
this.header = new String(decoder.decode(splitJwt[0].getBytes()));
|
|
||||||
this.payload = new String(decoder.decode(splitJwt[1].getBytes()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Builder(builderClassName = "verifyBuilder", builderMethodName = "verifyBuilder")
|
|
||||||
public JwtUtil(String secretKey, String jwt) {
|
|
||||||
this.verify(secretKey, jwt, Algorithm.HMAC512(secretKey.getBytes()));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Builder(builderClassName = "verifyBuilderByAlgorithm", builderMethodName = "verifyBuilderByAlgorithm")
|
|
||||||
public JwtUtil(String secretKey, String token, Algorithm algorithm) {
|
|
||||||
this.verify(secretKey, token, algorithm);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
private void verify(String secretKey, String jwt, Algorithm algorithm) {
|
|
||||||
if (StringUtils.isEmpty(secretKey))
|
|
||||||
throw new RuntimeException("SecretKey(은)는 필수조건 입니다.");
|
|
||||||
|
|
||||||
try {
|
import com.auth0.jwt.JWT;
|
||||||
System.out.println(String.format("[Token] => %s", jwt));
|
import com.auth0.jwt.algorithms.Algorithm;
|
||||||
this.claims = JWT.require(algorithm)
|
import com.auth0.jwt.interfaces.Claim;
|
||||||
.build()
|
|
||||||
.verify(jwt.replace("Bearer", "").trim())
|
|
||||||
.getClaims();
|
|
||||||
|
|
||||||
this.isCertified = true;
|
import lombok.Builder;
|
||||||
} catch (Exception e) {
|
import lombok.Getter;
|
||||||
this.isCertified = false;
|
|
||||||
System.out.println(String.format("Token Verify Fail... %s", e.getMessage()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void claimsToString() {
|
@Getter
|
||||||
System.out.println("[Token Claims]");
|
public class JwtUtil {
|
||||||
if (this.claims == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Iterator<String> it = this.claims.keySet().iterator();
|
@SuppressWarnings("unused")
|
||||||
while (it.hasNext()) {
|
public final static String DEFAULT_SECRET_KEY = "czovL3d3dy50ZXN0LmNvLmtyIiwicm9sZX";
|
||||||
String key = it.next();
|
|
||||||
Claim claim = this.claims.get(key);
|
private String token;
|
||||||
|
|
||||||
|
private String header;
|
||||||
|
private String payload;
|
||||||
|
|
||||||
|
private boolean isCertified = false;
|
||||||
|
private Map<String, Claim> claims;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Builder(builderClassName = "createBuilder", builderMethodName = "createBuilder")
|
||||||
|
public JwtUtil(String secretKey, String iss, String sub, String aud, Date exp, Date nbf, Date iat, String jti, String uUuid, String[] roles) {
|
||||||
|
if(StringUtils.isEmpty(secretKey))
|
||||||
|
throw new RuntimeException("SecretKey(은)는 필수조건 입니다.");
|
||||||
|
|
||||||
|
this.token = JWT.create()
|
||||||
|
.withIssuer(iss)
|
||||||
|
.withSubject(sub)
|
||||||
|
.withAudience(aud)
|
||||||
|
.withExpiresAt(exp)
|
||||||
|
.withNotBefore(nbf)
|
||||||
|
.withIssuedAt(iat)
|
||||||
|
.withJWTId(jti)
|
||||||
|
.withClaim("uUuid", uUuid)
|
||||||
|
.withArrayClaim("roles", roles)
|
||||||
|
.sign(Algorithm.HMAC512(secretKey.getBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Builder(builderClassName = "decodeBuilder", builderMethodName = "decodeBuilder")
|
||||||
|
public JwtUtil(String jwt) {
|
||||||
|
|
||||||
|
Decoder decoder = Base64.getDecoder();
|
||||||
|
final String[] splitJwt = jwt.split("\\.");
|
||||||
|
this.token = jwt;
|
||||||
|
this.header = new String(decoder.decode(splitJwt[0].getBytes()));
|
||||||
|
this.payload = new String(decoder.decode(splitJwt[1].getBytes()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Builder(builderClassName = "verifyBuilder", builderMethodName = "verifyBuilder")
|
||||||
|
public JwtUtil(String secretKey, String jwt) {
|
||||||
|
this.verify(secretKey, jwt, Algorithm.HMAC512(secretKey.getBytes()));
|
||||||
|
}
|
||||||
|
@Builder(builderClassName = "verifyBuilderByAlgorithm", builderMethodName = "verifyBuilderByAlgorithm")
|
||||||
|
public JwtUtil(String secretKey, String token, Algorithm algorithm) {
|
||||||
|
this.verify(secretKey, token, algorithm);
|
||||||
|
}
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private void verify(String secretKey, String jwt, Algorithm algorithm) {
|
||||||
|
if(StringUtils.isEmpty(secretKey))
|
||||||
|
throw new RuntimeException("SecretKey(은)는 필수조건 입니다.");
|
||||||
|
|
||||||
|
try {
|
||||||
|
System.out.println(String.format("[Token] => %s", jwt));
|
||||||
|
this.claims = JWT.require(algorithm)
|
||||||
|
.build()
|
||||||
|
.verify(jwt.replace("Bearer", "").trim())
|
||||||
|
.getClaims();
|
||||||
|
|
||||||
|
this.isCertified = true;
|
||||||
|
}catch(Exception e) {
|
||||||
|
this.isCertified = false;
|
||||||
|
System.out.println(String.format("Token Verify Fail... %s", e.getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void claimsToString() {
|
||||||
|
System.out.println("[Token Claims]");
|
||||||
|
if(this.claims == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<String> it = this.claims.keySet().iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
String key = it.next();
|
||||||
|
Claim claim = this.claims.get(key);
|
||||||
// System.out.println(String.format(" %s = %s", key, claim.asString()));
|
// System.out.println(String.format(" %s = %s", key, claim.asString()));
|
||||||
if (claim.asMap() != null)
|
if(claim.asMap() != null)
|
||||||
System.out.println(String.format(" %s = %s", key, claim.asMap().toString()));
|
System.out.println(String.format(" %s = %s", key, claim.asMap().toString()));
|
||||||
else if (claim.asArray(String.class) != null) {
|
else if(claim.asArray(String.class) != null) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (String str : claim.asArray(String.class))
|
for(String str : claim.asArray(String.class))
|
||||||
sb.append(",").append(str);
|
sb.append(",").append(str);
|
||||||
System.out.println(String.format(" %s = [%s]", key, sb.toString().substring(1)));
|
System.out.println(String.format(" %s = [%s]", key, sb.toString().substring(1)));
|
||||||
} else
|
} else
|
||||||
System.out.println(String.format(" %s = %s", key, claim.as(String.class)));
|
System.out.println(String.format(" %s = %s", key, claim.as(String.class)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,79 +1,79 @@
|
|||||||
package cokr.xit.ens.core.utils;
|
package cokr.xit.ens.core.utils;
|
||||||
|
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Getter;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
import javax.validation.ConstraintViolation;
|
|
||||||
import javax.validation.Validation;
|
|
||||||
import javax.validation.Validator;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@Builder
|
import javax.validation.ConstraintViolation;
|
||||||
@Getter
|
import javax.validation.Validation;
|
||||||
public class RequireValidator {
|
import javax.validation.Validator;
|
||||||
|
|
||||||
private Object obj;
|
|
||||||
|
|
||||||
private List<String> message = new ArrayList<>();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <pre>메소드 설명: 객체 검증
|
|
||||||
* -.검증을 통과하지 못한 필드의 메시지를 message 필드에 설정한다.
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* @return RequireValidator 요청처리 후 응답객체
|
|
||||||
* @author: 박민규
|
|
||||||
* @date: 2021. 8. 6.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
|
||||||
public RequireValidator validate() {
|
|
||||||
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
|
||||||
Set<ConstraintViolation<Object>> validate = validator.validate(this.obj);
|
|
||||||
|
|
||||||
if (!validate.isEmpty()) {
|
|
||||||
this.message = new ArrayList<String>();
|
|
||||||
|
|
||||||
Iterator it = validate.iterator();
|
|
||||||
while (it.hasNext()) {
|
|
||||||
ConstraintViolation<Object> cv = (ConstraintViolation<Object>) it.next();
|
|
||||||
this.message.add(cv.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return this;
|
import org.springframework.util.StringUtils;
|
||||||
}
|
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
@Builder
|
||||||
* <pre>메소드 설명: Exception 발생
|
@Getter
|
||||||
* -.message가 null이 아닐 경우 Exception을 발생 시킨다.
|
public class RequireValidator {
|
||||||
* </pre>
|
|
||||||
* void 요청처리 후 응답객체
|
private Object obj;
|
||||||
*
|
|
||||||
* @author: 박민규
|
private List<String> message = new ArrayList<>();
|
||||||
* @date: 2021. 8. 6.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
/**
|
||||||
public RequireValidator throwableException() {
|
* <pre>메소드 설명: 객체 검증
|
||||||
if (!StringUtils.isEmpty(this.message))
|
* -.검증을 통과하지 못한 필드의 메시지를 message 필드에 설정한다.
|
||||||
|
* </pre>
|
||||||
|
* @return RequireValidator 요청처리 후 응답객체
|
||||||
|
* @author: 박민규
|
||||||
|
* @date: 2021. 8. 6.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
|
public RequireValidator validate() {
|
||||||
|
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
|
||||||
|
Set<ConstraintViolation<Object>> validate = validator.validate(this.obj);
|
||||||
|
|
||||||
|
if(!validate.isEmpty()) {
|
||||||
|
this.message = new ArrayList<String>();
|
||||||
|
|
||||||
|
Iterator it = validate.iterator();
|
||||||
|
while(it.hasNext()) {
|
||||||
|
ConstraintViolation<Object> cv = (ConstraintViolation<Object>) it.next();
|
||||||
|
this.message.add(cv.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>메소드 설명: Exception 발생
|
||||||
|
* -.message가 null이 아닐 경우 Exception을 발생 시킨다.
|
||||||
|
* </pre>
|
||||||
|
* void 요청처리 후 응답객체
|
||||||
|
* @author: 박민규
|
||||||
|
* @date: 2021. 8. 6.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public RequireValidator throwableException() {
|
||||||
|
if(!StringUtils.isEmpty(this.message))
|
||||||
// throw new CustomException(RESP_CODE.INVALID_PARAMETER, message.toString());
|
// throw new CustomException(RESP_CODE.INVALID_PARAMETER, message.toString());
|
||||||
throw new RuntimeException(String.format("유효성 검증 Fail::: %s", message.toString()));
|
throw new RuntimeException(String.format("유효성 검증 Fail::: %s", message.toString()));
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (!StringUtils.isEmpty(this.message))
|
if(!StringUtils.isEmpty(this.message))
|
||||||
return message.toString();
|
return message.toString();
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoAcptReqVO;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(name = "BillAcptReqDTO")
|
||||||
|
public class BillAcptReqDTO {
|
||||||
|
|
||||||
|
@NotNull(message = "청구서ID 사용 여부는 필수 입력값 입니다.")
|
||||||
|
@Schema(required = true, title = "청구서ID 사용 여부", example = "false")
|
||||||
|
private Boolean use_bill_uid;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "청구서 유니크ID", example = " ")
|
||||||
|
private String bill_uid;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Schema(required = true, title = "청구서 타입", example = "all")
|
||||||
|
private BillSeCd bill_se;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
@JsonAlias({"bill_kko"})
|
||||||
|
private BillKkoAcptReqVO bill_kko;
|
||||||
|
// @Valid
|
||||||
|
// @JsonAlias({"bill_nv"})
|
||||||
|
// private BillNvAcptReqVO bill_nv;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill;
|
||||||
|
|
||||||
|
public interface BillAcptReqData<T> {
|
||||||
|
|
||||||
|
T get();
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill;
|
||||||
|
|
||||||
|
import cokr.xit.ens.core.aop.EnsResponseVO;
|
||||||
|
import cokr.xit.ens.core.exception.EnsException;
|
||||||
|
import cokr.xit.ens.core.exception.code.EnsErrCd;
|
||||||
|
import cokr.xit.ens.core.monitor.slack.event.MonitorEvent;
|
||||||
|
import cokr.xit.ens.core.utils.CmmnUtil;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.Bill;
|
||||||
|
import cokr.xit.ens.modules.common.monitor.MessageByBill;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationEventPublisher;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public abstract class BillMakerSupport implements Consumer<List<Bill>>, Function<List<Bill>, EnsResponseVO> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationEventPublisher applicationEventPublisher;
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void accept(List<Bill> bills) {
|
||||||
|
try {
|
||||||
|
Lists.partition(filter(bills), 500).stream()
|
||||||
|
.forEach(partBillUids -> {
|
||||||
|
List<Bill> partBills = findBillsByBillUidsAndNotExists(partBillUids);
|
||||||
|
acceptProc(partBills);
|
||||||
|
});
|
||||||
|
} catch (EnsException e) {
|
||||||
|
throw e;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new EnsException(EnsErrCd.BILL999, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(propagation = Propagation.REQUIRES_NEW)
|
||||||
|
@Override
|
||||||
|
public EnsResponseVO apply(List<Bill> bills) {
|
||||||
|
try {
|
||||||
|
if (CmmnUtil.isEmpty(bills))
|
||||||
|
return EnsResponseVO.okBuilder().build();
|
||||||
|
|
||||||
|
int cntTotFail = Lists.partition(filter(bills), 500).stream()
|
||||||
|
.map(partBillUids -> {
|
||||||
|
List<Bill> partBills = findBillsByBillUidsAndUrlIsNull(partBillUids);
|
||||||
|
if (partBills.size() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
return generateUrlProc(partBills);
|
||||||
|
})
|
||||||
|
.reduce(Integer::sum)
|
||||||
|
.get();
|
||||||
|
|
||||||
|
|
||||||
|
if (cntTotFail == 0)
|
||||||
|
return EnsResponseVO.okBuilder().build();
|
||||||
|
else
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(EnsErrCd.BILL512)
|
||||||
|
.errMsg(String.format("총 %d건 중 %d건 생성 실패", bills.size(), cntTotFail))
|
||||||
|
.build();
|
||||||
|
} catch (EnsException e) {
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(e.getErrCd())
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
} catch (Exception e) {
|
||||||
|
return EnsResponseVO.errBuilder()
|
||||||
|
.errCode(EnsErrCd.BILL999)
|
||||||
|
.errMsg(e.getMessage())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract protected BillSeCd getBillSeCd();
|
||||||
|
|
||||||
|
abstract protected List<String> filter(List<Bill> bills);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 청구서 접수 처리
|
||||||
|
* @param bills
|
||||||
|
* @throws EnsException
|
||||||
|
*/
|
||||||
|
abstract protected void acceptProc(List<Bill> bills) throws EnsException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 미접수 청구서 조회
|
||||||
|
* @param billUids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
abstract protected List<Bill> findBillsByBillUidsAndNotExists(List<String> billUids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 청구서 URL 생성 처리
|
||||||
|
* @param bills
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
abstract protected int generateUrlProc(List<Bill> bills);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL 미생성 청구서 조회
|
||||||
|
* @param billUids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
abstract protected List<Bill> findBillsByBillUidsAndUrlIsNull(List<String> billUids);
|
||||||
|
|
||||||
|
protected void errSend(EnsErrCd ensErrCd, String message, Exception e) {
|
||||||
|
|
||||||
|
applicationEventPublisher.publishEvent(MonitorEvent.builder()
|
||||||
|
.message(MessageByBill.builder()
|
||||||
|
.oClass(getClass().getSimpleName() + "." + new Throwable().getStackTrace()[0].getMethodName())
|
||||||
|
.billSeCd(getBillSeCd())
|
||||||
|
.errCd(ensErrCd)
|
||||||
|
.message(message + "\n" + CmmnUtil.printStackTraceToString(e))
|
||||||
|
.build())
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill;
|
||||||
|
|
||||||
|
public interface BillService<T, ACPTREQ, URLREQ> {
|
||||||
|
T accept(ACPTREQ acptreq);
|
||||||
|
|
||||||
|
T createUrl(URLREQ urlreq);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill;
|
||||||
|
|
||||||
|
public interface BillUrlReqData<T> {
|
||||||
|
|
||||||
|
T get();
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.code;
|
||||||
|
|
||||||
|
import cokr.xit.ens.core.code.CodeMapperType;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <ul>
|
||||||
|
* <li>업무 그룹명: 청구서API - 요청구분 코드</li>
|
||||||
|
* <li>설 명: </li>
|
||||||
|
* <li>작성일: 2022. 2. 15. 오후 3:51:43
|
||||||
|
* </ul>
|
||||||
|
* @author 박민규
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum BillReqSeCd implements CodeMapperType {
|
||||||
|
|
||||||
|
ACPT("요청 접수")
|
||||||
|
,URL("청구서링크생성")
|
||||||
|
,REURL("청구서링크재생성")
|
||||||
|
,NOTICE("청구서조회")
|
||||||
|
,PREPAY("납부가능조회")
|
||||||
|
,PAYRSLT("납부결과전달")
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String codeNm;
|
||||||
|
BillReqSeCd(String codeNm) {
|
||||||
|
this.code = this.name();
|
||||||
|
this.codeNm = codeNm;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCodeNm() {
|
||||||
|
return this.codeNm;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.entity;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.code.BillSeCd;
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@SuperBuilder
|
||||||
|
//@Inheritance(strategy = InheritanceType.JOINED)
|
||||||
|
//@DiscriminatorColumn(name = "dtype")
|
||||||
|
//@DiscriminatorValue("master")
|
||||||
|
@Table(name = "ens_bill", schema = "", catalog = "")
|
||||||
|
public class Bill extends BillEntity implements Serializable {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.TABLE, generator = "Bill_Generator")
|
||||||
|
@TableGenerator(table = "ens_seq_generator", name = "Bill_Generator"
|
||||||
|
, pkColumnName = "seq_name", pkColumnValue = "Bill_id"
|
||||||
|
, initialValue = 0, allocationSize = 200)
|
||||||
|
|
||||||
|
private Long billId;
|
||||||
|
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
|
||||||
|
@Column(name = "bill_se_cd")
|
||||||
|
private BillSeCd billSeCd;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "org_cd")
|
||||||
|
@Setter
|
||||||
|
private OrgMng orgMng;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "doc_bill_kko", nullable = true)
|
||||||
|
@Lob
|
||||||
|
private String docBillKko;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "doc_bill_nv", nullable = true)
|
||||||
|
@Lob
|
||||||
|
private String docBillNv;
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.repository;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.BillHist;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface BillHistRepository extends JpaRepository<BillHist, Long> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.repository;
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.repository;
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.Bill;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
@ -0,0 +1,10 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.repository;
|
||||||
|
|
||||||
|
public interface BillSeRepository {
|
||||||
|
|
||||||
|
String findUrlByBillUid(String billUid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
package cokr.xit.ens.biz.iup.billpay.api;
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.api;
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.BillKkoApiRespDTO;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface IupKkoPayUseSysApiSpec {
|
public interface BillKkoClientApiSpec {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 고객사별 납부가능조회 API 호출
|
* 고객사별 납부가능조회 API 호출
|
@ -0,0 +1,69 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.BillEntity;
|
||||||
|
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table(name = "ens_bill_kko", schema = "", catalog = "")
|
||||||
|
@Schema(name = "BillKko")
|
||||||
|
public class BillKko extends BillEntity {
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.TABLE, generator = "BillKko_Generator")
|
||||||
|
@TableGenerator(table = "ens_seq_generator", name = "BillKko_Generator"
|
||||||
|
, pkColumnName = "seq_name", pkColumnValue = "BillKko_id"
|
||||||
|
, initialValue = 0, allocationSize = 200)
|
||||||
|
@Schema(required = true, title = "PK", example = " ")
|
||||||
|
private Long billId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "기관에서 관리하는 해당 고객번호 혹은 계약번호", example = " ")
|
||||||
|
@Column(name = "biller_user_key", nullable = false, length = 40)
|
||||||
|
private String billerUserKey;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "청구 연월", example = " ")
|
||||||
|
@Column(name = "billed_year_month", nullable = true)
|
||||||
|
private String billedYearMonth;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "동일 고객번호 구분 값", example = " ")
|
||||||
|
@Column(name = "ordinal", nullable = true)
|
||||||
|
private String ordinal;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "개별 청구서를 식별하는 키 값", example = " ")
|
||||||
|
@Column(name = "biller_notice_key", nullable = true)
|
||||||
|
private String billerNoticeKey;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "URL 만료일", example = "20200130235959")
|
||||||
|
@Column(name = "expire_at", nullable = false)
|
||||||
|
private String expireAt;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "API 호출 시 함께 전달할 JSON형태의 문자열", example = " ")
|
||||||
|
@Column(name = "parameters", nullable = true)
|
||||||
|
@Lob
|
||||||
|
private String parameters;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "청구서조회/납부가능여부/납부결과 API Url정보 JSON형태의 문자열", example = " \"custom_url\": {\n" +
|
||||||
|
" \"notice_url\" : \" https://test-api.dozn.co.kr/kakao/notice\",\n" +
|
||||||
|
" \"prepay_url\": \"https://test-api.dozn.co.kr/kakao/prepay\",\n" +
|
||||||
|
" \"pay_result_url\": \" https://test-api.dozn.co.kr/kakao/pay-result\"\n" +
|
||||||
|
" }")
|
||||||
|
@Column(name = "custom_url", nullable = true, length = 500)
|
||||||
|
private String customUrl;
|
||||||
|
|
||||||
|
@Schema(required = false, title = "청구서URL", example = " ")
|
||||||
|
@Column(name = "url", nullable = true)
|
||||||
|
@Setter
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
@Embedded
|
||||||
|
@Setter
|
||||||
|
private FieldError error;
|
||||||
|
}
|
@ -1,117 +0,0 @@
|
|||||||
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity;
|
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.BillBaseEntity;
|
|
||||||
import cokr.xit.ens.modules.common.domain.support.FieldError;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.*;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
@SuperBuilder
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Table(name = "ens_bill_kko", schema = "", catalog = "")
|
|
||||||
@Schema(name = "BillKkoPay")
|
|
||||||
public class BillKkoPay extends BillBaseEntity {
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "BillKko_Generator")
|
|
||||||
@TableGenerator(table = "ens_seq_generator", name = "BillKko_Generator"
|
|
||||||
, pkColumnName = "seq_name", pkColumnValue = "BillKko_id"
|
|
||||||
, initialValue = 0, allocationSize = 200)
|
|
||||||
@Schema(required = true, title = "PK", example = " ")
|
|
||||||
private Long billId;
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(required = false, title = "청구 연월", example = " ")
|
|
||||||
@Column(name = "billed_year_month", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String billedYearMonth;
|
|
||||||
@Schema(required = false, title = "동일 고객번호 구분 값", example = " ")
|
|
||||||
@Column(name = "ordinal", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String ordinal;
|
|
||||||
@Schema(required = false, title = "개별 청구서를 식별하는 키 값", example = " ")
|
|
||||||
@Column(name = "biller_notice_key", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String billerNoticeKey;
|
|
||||||
@Schema(required = false, title = "URL 만료일", example = "20200130235959")
|
|
||||||
@Column(name = "expire_at", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String expireAt;
|
|
||||||
@Schema(required = false, title = "API 호출 시 함께 전달할 JSON형태의 문자열", example = " ")
|
|
||||||
@Column(name = "parameters", nullable = true)
|
|
||||||
@Lob
|
|
||||||
@Setter
|
|
||||||
private String parameters;
|
|
||||||
@Schema(required = false, title = "청구서조회/납부가능여부/납부결과 API Url정보 JSON형태의 문자열", example = " \"custom_url\": {\n" +
|
|
||||||
" \"notice_url\" : \" https://test-api.dozn.co.kr/kakao/notice\",\n" +
|
|
||||||
" \"prepay_url\": \"https://test-api.dozn.co.kr/kakao/prepay\",\n" +
|
|
||||||
" \"pay_result_url\": \" https://test-api.dozn.co.kr/kakao/pay-result\"\n" +
|
|
||||||
" }")
|
|
||||||
@Column(name = "custom_url", nullable = true, length = 500)
|
|
||||||
@Setter
|
|
||||||
private String customUrl;
|
|
||||||
@Schema(required = false, title = "청구서URL", example = " ")
|
|
||||||
@Column(name = "url", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String url;
|
|
||||||
/* =====================================
|
|
||||||
* 결제진행 - PayNotice 단계
|
|
||||||
===================================== */
|
|
||||||
@Schema(required = false, title = "청구서명", example = "테스트청구서")
|
|
||||||
@Column(name = "title", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String title;
|
|
||||||
@Schema(required = false, title = "납부 요청금액", example = "1000")
|
|
||||||
@Column(name = "amount", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private Integer amount;
|
|
||||||
@Schema(required = false, title = "비과세 금액", example = "0")
|
|
||||||
@Column(name = "tax_free_amount", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private Integer taxFreeAmount;
|
|
||||||
@Schema(required = false, title = "부가세 금액", example = "0")
|
|
||||||
@Column(name = "vat_amount", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private Integer vatAmount;
|
|
||||||
@Schema(required = false, title = "납기 안내타입", example = "D1")
|
|
||||||
@Column(name = "expire_type", nullable = true, length = 10)
|
|
||||||
@Setter
|
|
||||||
private String expireType;
|
|
||||||
@Schema(required = false, title = "첫번째 납기일", example = "20230212")
|
|
||||||
@Column(name = "pay_expire_date", nullable = true, length = 8)
|
|
||||||
@Setter
|
|
||||||
private String payExpireDate;
|
|
||||||
@Schema(required = false, title = "두번째 납기일", example = "20230212")
|
|
||||||
@Column(name = "second_pay_expire_date", nullable = true, length = 8)
|
|
||||||
@Setter
|
|
||||||
private String secondPayExpireDate;
|
|
||||||
@Schema(required = false, title = "계좌송금수단 사용 시 계좌정보", example = " ")
|
|
||||||
@Lob
|
|
||||||
@Column(name = "bank_accounts", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String bankAccounts;
|
|
||||||
@Schema(required = false, title = "청구서 상세정보", example = " ")
|
|
||||||
@Lob
|
|
||||||
@Column(name = "details", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private String details;
|
|
||||||
@Schema(required = false, title = "결제일시(YYYYMMDDHH24MISS)", example = "20190220161656")
|
|
||||||
@Column(name = "last_paid_at", nullable = true, length = 14)
|
|
||||||
@Setter
|
|
||||||
private String lastPaidAt;
|
|
||||||
@Schema(required = false, title = "결제번호", example = "2748877")
|
|
||||||
@Column(name = "last_pay_id", nullable = true)
|
|
||||||
@Setter
|
|
||||||
private Integer lastPayId;
|
|
||||||
|
|
||||||
@Embedded
|
|
||||||
@Setter
|
|
||||||
private FieldError error;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +1,12 @@
|
|||||||
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository;
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository;
|
||||||
|
|
||||||
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.BillKkoPay;
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.BillKko;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface BillKkoPayRepository extends JpaRepository<BillKkoPay, Long> {
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface BillKkoRepository extends JpaRepository<BillKko, Long>, BillKkoRepositoryCustom {
|
||||||
|
|
||||||
|
Optional<BillKko> findByBillUid(String billUid);
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BillKkoRepositoryCustom {
|
||||||
|
|
||||||
|
List<String> findBillUidsByBillUidIn(List<String> billUids);
|
||||||
|
|
||||||
|
List<String> findBillerUserKeysByBillerUserKeyIn(List<String> billerUserKeys);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.QBillKko.billKko;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class BillKkoRepositoryImpl implements BillKkoRepositoryCustom {
|
||||||
|
|
||||||
|
private final JPAQueryFactory query;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> findBillUidsByBillUidIn(List<String> billUids) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
Lists.partition(billUids, 1000)
|
||||||
|
.forEach(ids -> result.addAll(
|
||||||
|
query.select(billKko.billUid)
|
||||||
|
.from(billKko)
|
||||||
|
.where(billKko.billUid.in(ids))
|
||||||
|
.fetch())
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> findBillerUserKeysByBillerUserKeyIn(List<String> billerUserKeys) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
Lists.partition(billerUserKeys, 1000)
|
||||||
|
.forEach(ids -> result.addAll(
|
||||||
|
query.select(billKko.billerUserKey)
|
||||||
|
.from(billKko)
|
||||||
|
.where(billKko.billerUserKey.in(ids))
|
||||||
|
.fetch())
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.repository;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.entity.repository.BillSeRepository;
|
||||||
|
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import static cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.entity.QBillKko.billKko;
|
||||||
|
|
||||||
|
@Repository(value = "bpKko")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class BillSeKkoRepositoryImpl implements BillSeRepository {
|
||||||
|
|
||||||
|
private final JPAQueryFactory query;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String findUrlByBillUid(String billUid) {
|
||||||
|
String url = query.select(billKko.url)
|
||||||
|
.from(billKko)
|
||||||
|
.where(billKko.billUid.eq(billUid)
|
||||||
|
.and(billKko.url.isNotNull())
|
||||||
|
)
|
||||||
|
.fetchOne();
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Schema(name = "BillKkoAcptReqDTO")
|
||||||
|
public class BillKkoAcptReqDTO {
|
||||||
|
|
||||||
|
@NotBlank(message = "(계약정보)빌러코드는 필수 입력값 입니다.")
|
||||||
|
@Schema(required = true, title = "(계약정보)빌러코드", example = "LIF378880088002")
|
||||||
|
@JsonAlias({"biller_code"})
|
||||||
|
private String billerCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "(계약정보)허가코드는 필수 입력값 입니다.")
|
||||||
|
@Schema(required = true, title = "(계약정보)허가코드", example = "LG7upsMTsXbQiMGP4htZi/IXS7LJvEOmAx2HmY6X6Q8jh1dpv6vgNxbA4a4H2n3r")
|
||||||
|
@JsonAlias({"authorization"})
|
||||||
|
private String authorization;
|
||||||
|
|
||||||
|
@Valid
|
||||||
|
@JsonAlias({"documents"})
|
||||||
|
private BillKkoAcptReqVO documents;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model;
|
||||||
|
|
||||||
|
import cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model.config.CustomUrl;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAlias;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Getter
|
||||||
|
@Schema(name = "BillKkoAcptReqVO")
|
||||||
|
public class BillKkoAcptReqVO {
|
||||||
|
|
||||||
|
@Length(max = 45, message = "청구서 유니크 아이디의 최대 길이를 초과 했습니다.")
|
||||||
|
@Schema(required = false, title = "청구서 유니크 아이디", example = " ")
|
||||||
|
@JsonAlias({"bill_uid"})
|
||||||
|
@Setter
|
||||||
|
private String billUid;
|
||||||
|
|
||||||
|
@NotEmpty(message = "계약번호는 필수 입력값 입니다.")
|
||||||
|
@Length(max = 50, message = "계약번호의 최대 길이를 초과 했습니다.")
|
||||||
|
@Schema(required = true, title = "기관에서 관리하는 해당 고객번호 혹은 계약번호", example = " ")
|
||||||
|
@JsonAlias({"biller_user_key"})
|
||||||
|
private String billerUserKey;
|
||||||
|
|
||||||
|
@Length(max = 6, message = "청구연월의 최대 길이를 초과 했습니다.")
|
||||||
|
@Schema(required = false, title = "청구 연월", example = "202203")
|
||||||
|
@JsonAlias({"billed_year_month"})
|
||||||
|
private String billedYearMonth;
|
||||||
|
|
||||||
|
@Length(max = 24, message = "고객번호구분값의 최대 길이를 초과 했습니다.")
|
||||||
|
@Schema(required = false, title = "동일 고객번호 구분 값", example = " ")
|
||||||
|
@JsonAlias({"ordinal"})
|
||||||
|
private String ordinal;
|
||||||
|
|
||||||
|
@Length(max = 80, message = "개별청구서식별키의 최대 길이를 초과 했습니다.")
|
||||||
|
@Schema(required = false, title = "개별 청구서를 식별하는 키 값", example = " ")
|
||||||
|
@JsonAlias({"biller_notice_key"})
|
||||||
|
private String billerNoticeKey;
|
||||||
|
|
||||||
|
@NotEmpty(message = "URL만료일은 필수 입력값 입니다.")
|
||||||
|
@Schema(required = true, title = "URL 만료일", example = "20200130235959")
|
||||||
|
@JsonAlias({"expire_at"})
|
||||||
|
private String expireAt;
|
||||||
|
|
||||||
|
|
||||||
|
// @Valid
|
||||||
|
// private Parameters parameters;
|
||||||
|
@Schema(required = false, title = "API 호출 시 함께 전달할 JSON형태의 문자열", example = "{\"some_param\": \"...\"}")
|
||||||
|
@JsonAlias({"parameters"})
|
||||||
|
private Map<String, String> parameters;
|
||||||
|
|
||||||
|
|
||||||
|
// " \"notice_url\" : \" https://test-api.dozn.co.kr/kakao/notice\",\n" +
|
||||||
|
// " \"prepay_url\": \"https:// test-api.dozn.co.kr/kakao/prepay\",\n" +
|
||||||
|
// " \"pay_result_url\": \" https:// test-api.dozn.co.kr/kakao/pay-result\"\n" +
|
||||||
|
// " }")
|
||||||
|
@Valid
|
||||||
|
@JsonAlias({"custom_url"})
|
||||||
|
private CustomUrl customUrl;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Schema(name = "BillKkoRsltFwdFailDTO")
|
||||||
|
public class BillKkoRsltFwdFailDTO {
|
||||||
|
|
||||||
|
@Schema(title = "기관코드", example = " ")
|
||||||
|
private String org_cd;
|
||||||
|
@Schema(title = "기관코드명", example = " ")
|
||||||
|
private String org_nm;
|
||||||
|
@Schema(title = "빌러유저키", example = " ")
|
||||||
|
private List<String> biller_user_key;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package cokr.xit.ens.modules.common.ctgy.intgrnbill.kko.model;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@Schema(name = "BillKkoRsltFwdFailSearchDTO")
|
||||||
|
public class BillKkoRsltFwdFailSearchDTO {
|
||||||
|
|
||||||
|
@Schema(title = "기관코드", example = "[]")
|
||||||
|
private List<String> schOrgCd;
|
||||||
|
@Schema(title = "기관코드명", example = "[]")
|
||||||
|
private List<String> schOrgNm;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue