feat: NICE CI accept 진행

dev
Jonguk. Lim 2 months ago
parent 9df9cd0a24
commit b0946c2201

@ -75,7 +75,8 @@ SELECT *
FROM tb_input_xit tix
JOIN tb_input_data_xit tidx
ON tix.lnk_input_id=tidx.lnk_input_id
WHERE tix.send_type='NI'
WHERE 1=1
-- AND tix.send_type='NI'
AND tix.prcs_cd='TGRG';
-- 2. bill 생성

@ -91,6 +91,7 @@ public class KkoPayUrlService implements PayUrlService<PayUrlData<BillKkoPay>, S
/**
* FIXME: NICE CI
* FIXME: Comment Url API
* [ () ]
* @Operation(summary = "납부(결제)정보 요청")

@ -0,0 +1,29 @@
package cokr.xit.ens.modules.nice.mapper;
import java.util.*;
import org.apache.ibatis.annotations.*;
import cokr.xit.ens.modules.nice.model.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.mapper
* fileName : INiceMapper
* author : limju
* date : 2024 9 30
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 30 limju
*
* </pre>
*/
@Mapper
public interface INiceCiMapper {
List<NiceCiDTO.InputXit> selectNiceCiAcceptTgts(final NiceCiDTO.InputXit inputXit);
List<NiceCiDTO.InputDataXit> selectNiceCiAcceptDatas(final NiceCiDTO.InputXit inputXit);
int saveBill(final NiceCiDTO.BillDTO bill);
}

@ -0,0 +1,198 @@
package cokr.xit.ens.modules.nice.model;
import java.time.*;
import java.util.*;
import javax.persistence.*;
import cokr.xit.ens.biz.iup.code.*;
import cokr.xit.ens.core.jpa.support.*;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.code.*;
import io.swagger.v3.oas.annotations.media.*;
import lombok.*;
import lombok.experimental.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.nice.model
* fileName : NiceCiDTO
* author : limju
* date : 2024 9 30
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 30 limju
*
* </pre>
*/
public class NiceCiDTO {
@Schema(name = "InputXit DTO", description = "InputXit DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class InputXit {
/**
*
*/
private Long lnkInputId;
/**
*
*/
private String orgCd;
/**
*
*/
private String jobCd;
/**
*
*/
private Long totCnt;
/**
*
*/
@Enumerated(EnumType.STRING)
private IupPrcsCd prcsCd;
/**
*
*/
private String errMsg;
/**
*
*/
private LocalDateTime runDt;
/**
*
*/
private LocalDateTime expiresDt;
/**
*
*/
@Enumerated(EnumType.STRING)
private IupSendTypeCd sendType;
/**
*
*/
private String rcptDt;
/**
*
*/
private LocalDateTime payExpiresDt;
List<InputDataXit> inputDataXits = new ArrayList<>();
private String regId;
private LocalDateTime regDt;
private String updId;
private LocalDateTime updDt;
}
@Schema(name = "InputDataXit DTO", description = "InputDataXit DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper = false)
public static class InputDataXit {
private String dataId;
private Long lnkInputId;
private String birthday;
private String callCenterNo;
private String carNo;
private String gender;
private String linkedUuid;
private String moblphonNo;
private String msgData;
@Lob
private String msgDtlData;
private String name;
private String payStatusCd;
private String payUrl;
private String sid;
private String regId;
private LocalDateTime regDt;
private String updId;
private LocalDateTime updDt;
}
@Schema(name = "BillDTO DTO", description = "BillDTO DTO")
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public static class BillDTO {
private Long billId;
private String billUid;
private String billerUserKey;
/**
*
*/
@Enumerated(EnumType.STRING)
private BillSeCd billSeCd;
private String orgCd;
/**
*
*/
@Convert(converter = BooleanToYnConverter.class)
private Boolean paidAt;
/**
*
*/
@Enumerated(EnumType.STRING)
private PaidTypeCd paidType;
/**
* () - 14
*/
private String paidDt;
/**
* () - 14
*/
private String paidCancelDt;
/**
*
*/
@Lob
private String docBillKko;
/**
*
*/
@Lob
private String docBillNv;
}
}

@ -28,6 +28,13 @@ import lombok.*;
@RequestMapping(value = "/nice/talk")
public class NiceCiController {
private final NiceCiService niceCiService;
private final NiceCiAcceptService niceCiAcceptService;
@Operation(summary = "접수")
@PostMapping(value = "/accept", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> accept() {
return new ResponseEntity<>(niceCiAcceptService.accept(), HttpStatus.OK);
}
@Operation(summary = "(대량)전송요청")
@PostMapping(value = "/send/bulk", produces = MediaType.APPLICATION_JSON_VALUE)

@ -0,0 +1,107 @@
package cokr.xit.ens.modules.nice.service;
import java.util.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;
import cokr.xit.ens.biz.iup.code.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.modules.common.code.*;
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*;
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 : NiceCiService
* author : limju
* date : 2024 9 27
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 27 limju
*
* </pre>
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class NiceCiAcceptService {
@Value("${contract.niceCi.orgId}")
private String ORG_ID;
@Value("${contract.niceCi.clientId}")
private String CLIENT_ID;
private final KeySequenceService keySequenceService;
private final NiceCiApiService niceCiApiService;
private final INiceCiMapper niceCiMapper;
/**
* <pre>
* -- 1.
* SELECT *
* FROM tb_input_xit tix
* JOIN tb_input_data_xit tidx
* ON tix.lnk_input_id=tidx.lnk_input_id
* WHERE 1=1
* -- AND tix.send_type='NI'
* AND tix.prcs_cd='TGRG'
*
* -- 2. bill
* -- 3.
* -- 4. tb_input_data_xit pay_url URL UPDATE
* -- 5. tb_input_xit prcs_cd='GRUC' / prcs_cd='TGRF'
* @return
* </pre>
*/
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO<?> accept(){
NiceCiDTO.InputXit inputXit = NiceCiDTO.InputXit.builder()
.sendType(IupSendTypeCd.NI)
.prcsCd(IupPrcsCd.TGRG)
.build();
final List<NiceCiDTO.InputXit> list = niceCiMapper.selectNiceCiAcceptTgts(inputXit);
list.forEach(niceCiMapper::selectNiceCiAcceptDatas);
final String prefixBillUid = PostSeCd.intgrnNoti.getCode() + "-" + IdGenerator.getCurrentTimeSec();
List<NiceCiDTO.BillDTO> bills = new ArrayList<>();
for(NiceCiDTO.InputXit d : list){
List<NiceCiDTO.InputDataXit> inputDataXits = niceCiMapper.selectNiceCiAcceptDatas(d);
// bill
bills.add(
NiceCiDTO.BillDTO.builder()
//.billId(keySequenceService.getKeySequence("bill_id"))
.billUid(IdGenerator.getShortUUID(prefixBillUid))
//.billerUserKey(document.getXit_property().getBill_acpt_data().getBillerUserKey())
//.billSeCd(document.getXit_property().getBill_acpt_data().getBillSe())
//.orgMng(OrgMng.builder().orgCd(reqDTO.getOrg_cd()).build())
.build()
);
}
bills.forEach(b -> {
b.setBillId(keySequenceService.getKeySequence("bill_id"));
niceCiMapper.saveBill(b);
});
return EnsResponseVO.okBuilder()
//.resultInfo(niceCiMapper.selectAcceptTgts(null))
.build();
}
}

@ -6,6 +6,7 @@ import org.springframework.stereotype.*;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.modules.nice.cmm.*;
import cokr.xit.ens.modules.nice.mapper.*;
import cokr.xit.ens.modules.nice.model.*;
import cokr.xit.ens.modules.nice.service.support.*;
import lombok.*;
@ -37,6 +38,8 @@ public class NiceCiService {
private final NiceCiApiService niceCiApiService;
private final INiceCiMapper niceCiMapper;
final String msg = "민자도로 관리지원센터에서 김해찬님께 발송한 미납통행료 고지서가 도착했습니다.\n"
+ "\n"
+ "민자도로 미납통행료 고지서\n"
@ -58,11 +61,6 @@ public class NiceCiService {
+ "\n"
+ "문의처 : 044-211-3377";
public EnsResponseVO<?> accept(){
return null;
}
public EnsResponseVO<?> requestSendBulk() {
NiceCiApiDTO.Request ciRequest = new NiceCiApiDTO.Request();

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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="selectNiceCiAcceptTgts" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit">
/** iup-niceci-mapper|selectNiceCiAcceptTgts-NICE CI 발송 대상 조회|julim */
SELECT lnk_input_id
, err_msg
, expires_dt
, org_cd
, pay_expires_dt
, prcs_cd
, rcpt_dt
, run_dt
, send_type
, tot_cnt
, job_cd
, reg_dt
, reg_id
, upd_dt
, upd_id
FROM tb_input_xit
-- WHERE send_type='NI'
-- AND prcs_cd='TGRG';
where ORG_CD = '0005'
</select>
<select id="selectNiceCiAcceptDatas" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputXit" resultType="cokr.xit.ens.modules.nice.model.NiceCiDTO$InputDataXit">
/** iup-niceci-mapper|selectNiceCiAcceptDatas-NICE CI 발송 대상 조회|julim */
SELECT data_id
, birthday
, call_center_no
, car_no
, gender
, linked_uuid
, moblphon_no
, msg_data
, msg_dtl_data
, name
, pay_status_cd
, pay_url
, sid
, lnk_input_id
, reg_dt
, reg_id
, upd_dt
, upd_id
FROM tb_input_data_xit
WHERE lnk_input_id = #{lnkInputId}
</select>
<insert id="saveBill" parameterType="cokr.xit.ens.modules.nice.model.NiceCiDTO$BillDTO">
/** iup-niceci-mapper|saveBill-NICE CI 청구서 생성|julim */
INSERT INTO ens_bill (
bill_id,
bill_uid,
bill_se_cd,
-- doc_bill_kko,
-- doc_bill_nv,
org_cd,
biller_user_key,
-- paid_at,
-- paid_cancel_dt,
-- paid_dt,
-- paid_type,
regist_dt
) VALUES (
#{billId},
#{billUid},
#{billSeCd},
#{orgCd},
#{billerUserKey},
sysdate
) )
</insert>
</mapper>
Loading…
Cancel
Save