marseyes лет назад: 2
Родитель
Сommit
ead87323aa

+ 49 - 1
src/main/java/com/oqpo/api/service/loanmng/EasypayPaymentService.java

@@ -429,7 +429,10 @@ public class EasypayPaymentService extends CommonService {
429 429
                     // payInfo.setCancelDate(null);
430 430
                     unpaidMngMapper.insertPgKiccPayPtcl(userId, payInfo);
431 431
 
432
-                    if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
432
+                    if (PayTpCd.PRE_PAY_CHARGE.getCd().equals(easypayPaymentRequest.getPayTpCd()) //
433
+                            || PayTpCd.AFTER_PRE_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 선결제/충전
434
+                        procPreChargePayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
435
+                    } else if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
433 436
                         procAfterPayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
434 437
                     }
435 438
                 } catch (Exception e) {
@@ -477,6 +480,51 @@ public class EasypayPaymentService extends CommonService {
477 480
         }
478 481
     }
479 482
 
483
+    private void procPreChargePayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
484
+        // 1. 여신관리기본정보
485
+        LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());
486
+
487
+        long trscBfBal = infoEntity.getAcctBal();
488
+        long trscAfBal = infoEntity.getAcctBal() + Long.parseLong(r_amount);
489
+        // 계좌잔액 증가
490
+        infoEntity.setAcctBal(trscAfBal);
491
+        dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
492
+
493
+        // 2. 여신관리상세이력
494
+        // 2.1 입금 처리
495
+        LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
496
+        hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
497
+        hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
498
+        hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
499
+        hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
500
+        // 11:신용카드, 21:계좌이체
501
+        if ("11".equals(r_pay_type)) {
502
+            hstEntity.setMediaDvsn(MediaDvsn.CARD.getCd());
503
+        } else if ("21".equals(r_pay_type)) {
504
+            hstEntity.setMediaDvsn(MediaDvsn.ACCOUNT.getCd());
505
+        }
506
+        hstEntity.setPayType(PayType.PRE_PAYMENT.getCd());
507
+        hstEntity.setTrscAmt(Long.parseLong(r_amount)); // 거래금액
508
+        hstEntity.setTrscBfBal(trscBfBal);
509
+        hstEntity.setTrscAfBal(trscAfBal);
510
+        dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
511
+
512
+        // 4. 여신관리입금처리
513
+        LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
514
+        entity.setDsptMgntNo(fnGetDealNo(21, "")); // 입금관리번호
515
+        entity.setReqDt(DateUtil.getCurrentDate());
516
+        entity.setReqTm(DateUtil.getCurrentTime());
517
+        entity.setDpstAmt(Long.parseLong(r_amount)); // 입금금액
518
+        entity.setDpstDt(entity.getReqDt()); // 입금일자
519
+        entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd());
520
+        entity.setDpstReqId(userId);
521
+        entity.setStoreId(payInfo.getStoreId());
522
+        entity.setBrandId(payInfo.getBrandId());
523
+        entity.setPoOrdNo(payInfo.getPoOrdNo());
524
+        entity.setPgId("KICC");
525
+        dsptMngMapper.insertLoanMgntDsptProcInfo(userId, entity);
526
+    }
527
+
480 528
     private void procAfterPayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
481 529
         // 2. 여신관리기본정보
482 530
         LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());