feat: NICE CI 인증톡 반영 완료

close 처리
dev
Jonguk. Lim 1 month ago
parent 1c8378ddb3
commit 7eea9fe722

@ -32,6 +32,7 @@
# FIXME: NICE CI 인증톡 추가
*/1 9-18 * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/send/bulk/all
*/30 9-21 * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/stat/bulk/all
0 9-21 * * * curl -X POST https://phts-manager.koti.re.kr/nice/talk/stat/closed
#---------------------------------------------#
# [ENS] 로그 데이터 삭제 스케줄러

@ -296,17 +296,8 @@ SELECT
SELECT tidx.data_id
, tix.SEND_TYPE
, tix.RUN_DT
, tix.EXPIRES_DT
, '' AS prcsYn
, tnssr.IHIDNUM
FROM tb_nice_sms_sndng_requst tnssr
JOIN TB_INPUT_DATA_XIT tidx
ON tnssr.DATA_ID = tidx.data_id
JOIN TB_INPUT_XIT tix
ON tidx.LNK_INPUT_ID = tix.LNK_INPUT_ID
WHERE 1=1
AND tnssr.ihidnum = '8312181111111' -- #{ihidnum} -- 응답받은 주민번호
-- AND REGEXP_REPLACE(tnssr.sndng_mssage, '[[:space:]]+', '') = REGEXP_REPLACE(#{sndngMssage}, '[[:space:]]+', '') -- 응답받은 발송메시지
select *
from TB_SEND_RESULT
where 1=1
and LNK_INPUT_ID = 20211006000001
and SEND_STTUS_CD = 'FAIL';

@ -44,60 +44,16 @@ public class NiceCiDTO {
*/
private Long lnkInputId;
/**
*
*/
private String reqStatusCd;
/**
*
*/
private String jobCd;
// private String signguCode;
// private String ffnlgCode;
// private String profile;
//
// /**
// * 통합 발송 마스터 id
// */
// private String unitySndngMastrId;
// /**
// * 통합 발송 마스터 id
// */
// private String unitySndngDetailId;
// /**
// * 발송 마스터 id
// */
// private String sndngMastrId;
//
// /**
// * 발송상세ID
// */
// private String sndngDetailId;
//
// /**
// * 템플릿ID
// */
// private String tmplatId;
//
// /**
// * 발송 건수
// */
// private int sndngCo;
//
// private String sndngProcessSttus;
// /**
// * 발송 처리 상태
// */
// private String newSndngProcessSttus;
//
// private String try1;
// private String try2;
// private String try3;
// private int tryCnt;
// private int trySeq;
// private String sndngSeCode;
// private String sndngDt;
// private String sndngDt2;
// private String sndngDt3;
// private String try2Minute;
// private String try3Minute;
private String errorCode;
private String errorMessage;

@ -30,6 +30,7 @@ public class NiceCiController {
private final NiceCiAcceptService niceCiAcceptService;
private final NiceCiSendBulkService niceCiSendService;
private final NiceCiStatBulkService niceCiStatBulkService;
private final NiceCiCloseService niceCiCloseService;
@Operation(summary = "접수")
@PostMapping(value = "/accept/all", produces = MediaType.APPLICATION_JSON_VALUE)
@ -48,4 +49,10 @@ public class NiceCiController {
public ResponseEntity<?> findBulkStatus() {
return new ResponseEntity<>(niceCiStatBulkService.findBulkStatus(), HttpStatus.OK);
}
@Operation(summary = "마감(종료)")
@PostMapping(value = "/stat/closed", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> cloased() {
return new ResponseEntity<>(niceCiCloseService.close(), HttpStatus.OK);
}
}

@ -87,6 +87,7 @@ public class NiceCiAcceptService {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.TGRG.getCode())
.reqStatusCd("ACCEPT")
.build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);

@ -0,0 +1,91 @@
package cokr.xit.ens.modules.nice.service;
import java.util.*;
import org.apache.commons.lang3.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.*;
import cokr.xit.ens.biz.iup.code.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import cokr.xit.ens.modules.nice.service.support.*;
import lombok.*;
import lombok.extern.slf4j.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.service
* fileName : NiceCiStatBulkService
* author : limju
* date : 2024 9 27
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 27 limju
*
* </pre>
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class NiceCiCloseService {
@Value("${contract.niceCi.orgId}")
private String ORG_ID;
@Value("${contract.niceCi.isStatusFail}")
private boolean IS_STATUS_FAIL;
private final NiceCiApiService niceCiApiService;
private final NiceCiNewTransactionService niceCiNewTransactionService;
private final INiceCiMapper niceCiMapper;
/**
* <pre>
* -- 1.
* SELECT *
* FROM tb_input_xit tix
* WHERE tix.send_type='NI'
* AND tix.prcs_cd='IPCP';
* AND tix.expires_dt < SYSDATE - 1;
*
* -- tb_input_xit prcs_cd='CLOS' / (update error) prcs_cd='FAIL'
* @return EnsResponseVO
* </pre>
*/
public EnsResponseVO<?> close() {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode())
.reqStatusCd("CLOS")
.build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);
if(list.isEmpty()){
return EnsResponseVO.errBuilder()
.errCode(EnsErrCd.ERR404)
.errMsg(EnsErrCd.ERR404.getCodeNm())
.build();
}
for(NiceCiDTO.InputXit xit : list) {
try {
xit.setPrcsCd("CLOS");
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
} catch (Exception e) {
xit.setPrcsCd("FAIL");
xit.setErrMsg(ObjectUtils.isNotEmpty(e.getCause()) ? e.getCause().getMessage() : e.getMessage());
niceCiMapper.updatePrcsCdAndErrorOfInputXit(xit);
}
}
return EnsResponseVO.okBuilder()
//.resultInfo(niceCiMapper.selectAcceptTgts(null))
.build();
}
}

@ -64,6 +64,7 @@ public class NiceCiSendBulkService {
final NiceCiDTO.NiceCiParam niceCiParam = NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.GRUC.getCode())
.reqStatusCd("SEND")
.build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectInputXits(niceCiParam);

@ -75,6 +75,7 @@ public class NiceCiStatBulkService {
NiceCiDTO.NiceCiParam.builder()
.sendType(IupSendTypeCd.NI.getCode())
.prcsCd(IupPrcsCd.IPCP.getCode())
.reqStatusCd("STATUS")
.build()
)
.orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, "검색기간 설정 조회 실패"));

@ -2,10 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.ens.modules.nice.mapper.INiceCiMapper">
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- ================================ 공통 =========================================== -->
<!-- =================================================================================== -->
<select id="selectInputXits" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|selectInputXits-NICE CI 대상 조회|julim */
SELECT lnk_input_id
@ -26,9 +26,12 @@
FROM tb_input_xit
WHERE send_type = #{sendType}
AND prcs_cd = #{prcsCd}
<if test="sendType eq 'GRUC'">
<if test="reqStatusCd eq 'GRUC'">
AND run_dt &lt; sysdate
</if>
<if test="reqStatusCd eq 'CLOS'">
AND expires_dt &lt; SYSDATE - 1
</if>
</select>
<select id="selectInputDataXits" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$NiceCiParam" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputDataXit">
@ -55,6 +58,23 @@
WHERE lnk_input_id = #{lnkInputId}
</select>
<update id="updatePrcsCdAndErrorOfInputXit" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|updatePrcsCdAndErrorOfInputXit-prcsCd and errorupdate|julim */
UPDATE tb_input_xit
SET prcs_cd = #{prcsCd}
, err_msg = SUBSTR(#{errMsg}, 0, 1000)
, upd_dt = sysdate
, upd_id = 'ENS_SYS'
WHERE lnk_input_id = #{lnkInputId}
</update>
<!-- =================================================================================== -->
<!-- ================================ 공통 =========================================== -->
<!-- =================================================================================== -->
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- =================================================================================== -->
<insert id="insertBill" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillDTO">
/** iup-niceci-mapper|insertBill-NICE CI 청구서 생성|julim */
INSERT INTO ens_bill (
@ -159,15 +179,6 @@
WHERE lnk_input_id = #{lnkInputId}
</update>
<update id="updatePrcsCdAndErrorOfInputXit" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|updatePrcsCdAndErrorOfInputXit-prcsCd and errorupdate|julim */
UPDATE tb_input_xit
SET prcs_cd = #{prcsCd}
, err_msg = SUBSTR(#{errMsg}, 0, 1000)
WHERE lnk_input_id = #{lnkInputId}
</update>
<select id="selectKkoBpApiUrlFromEnsOrgMng" parameterType="string" resultType="cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng">
/** iup-niceci-mapper|selectKkoBpApiUrlFromEnsOrgMng-API url 조회|julim */
SELECT kko_bp_url_api AS kkoBpUrlApi
@ -488,5 +499,4 @@
<!-- =================================================================================== -->
<!-- ================================ status =========================================== -->
<!-- =================================================================================== -->
</mapper>

Loading…
Cancel
Save