Kaynağa Gözat

입금승인 개선

marseyes 2 yıl önce
ebeveyn
işleme
fffd1f1343

+ 37 - 15
src/main/java/com/oqpo/api/service/loanmng/DsptMngService.java

@@ -9,6 +9,7 @@ import com.oqpo.api.entity.settmng.StlMgntBaseInfoEntity;
9 9
 import com.oqpo.api.enums.DpstPayDvsn;
10 10
 import com.oqpo.api.enums.DpstStCd;
11 11
 import com.oqpo.api.enums.MediaDvsn;
12
+import com.oqpo.api.enums.PayType;
12 13
 import com.oqpo.api.exception.GlobalException;
13 14
 import com.oqpo.api.mapper.loanmng.DsptMngMapper;
14 15
 import com.oqpo.api.mapper.oper.UserMngMapper;
@@ -160,21 +161,21 @@ public class DsptMngService extends CommonService {
160 161
             dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
161 162
 
162 163
             // 여신관리상세이력 등록
163
-            LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
164
-            hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
165
-            hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
166
-            hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
167
-            hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
168
-            hstEntity.setTrscAmt(procEntity.getDpstAmt()); // 거래금액
169
-            hstEntity.setTrscBfBal(trscBfBal);
170
-            hstEntity.setTrscAfBal(trscAfBal);
171
-            hstEntity.setMediaDvsn(MediaDvsn.BANKING.getCd());
172
-            hstEntity.setRcvAcctNo(procEntity.getRcvAcctNo()); // 입금계좌번호 - 매장 송금계좌
173
-            hstEntity.setDpstDt(procEntity.getDpstDt());
174
-            hstEntity.setDpstNm(procEntity.getDpstNm());
175
-            hstEntity.setDpstBnkCd(procEntity.getDpstBnkCd());
176
-            hstEntity.setDsptMgntNo(procEntity.getDsptMgntNo());
177
-            dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
164
+            LoanMgntDtlHstEntity hstEntity1 = new LoanMgntDtlHstEntity();
165
+            hstEntity1.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
166
+            hstEntity1.setLoanRegDt(DateUtil.getCurrentDate());
167
+            hstEntity1.setLoanRegTm(DateUtil.getCurrentTime());
168
+            hstEntity1.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
169
+            hstEntity1.setTrscAmt(procEntity.getDpstAmt()); // 거래금액
170
+            hstEntity1.setTrscBfBal(trscBfBal);
171
+            hstEntity1.setTrscAfBal(trscAfBal);
172
+            hstEntity1.setMediaDvsn(MediaDvsn.BANKING.getCd());
173
+            hstEntity1.setRcvAcctNo(procEntity.getRcvAcctNo()); // 입금계좌번호 - 매장 송금계좌
174
+            hstEntity1.setDpstDt(procEntity.getDpstDt());
175
+            hstEntity1.setDpstNm(procEntity.getDpstNm());
176
+            hstEntity1.setDpstBnkCd(procEntity.getDpstBnkCd());
177
+            hstEntity1.setDsptMgntNo(procEntity.getDsptMgntNo());
178
+            dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity1);
178 179
 
179 180
             // 여신관리입금처리
180 181
             LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
@@ -189,11 +190,32 @@ public class DsptMngService extends CommonService {
189 190
 
190 191
             // 정산관리고유번호 처리
191 192
             if (!StringUtil.isEmpty(procEntity.getSttlMgntUnqNo())) {
193
+                // 1. 정산관리기본정보 수납처리
192 194
                 StlMgntBaseInfoEntity stlEntity = new StlMgntBaseInfoEntity();
193 195
                 stlEntity.setSttlMgntUnqNo(procEntity.getSttlMgntUnqNo());
194 196
                 stlEntity.setRcptYn("Y");
195 197
                 stlEntity.setRcptAmt(procEntity.getDpstAmt());
196 198
                 sttlReqMapper.updateStlMgntBaseInfo4Rcpt(userId, stlEntity);
199
+
200
+                // 2. 여신관리기본정보 처리
201
+                infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(procEntity.getBrandId(), procEntity.getStoreId());
202
+                trscBfBal = infoEntity.getAcctBal();
203
+                trscAfBal = infoEntity.getAcctBal() - procEntity.getDpstAmt();
204
+                infoEntity.setAcctBal(trscAfBal); // 계좌잔액
205
+                dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
206
+
207
+                // 3. 여신관리상세이력
208
+                LoanMgntDtlHstEntity hstEntity2 = new LoanMgntDtlHstEntity();
209
+                hstEntity2.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
210
+                hstEntity2.setLoanRegDt(DateUtil.getCurrentDate());
211
+                hstEntity2.setLoanRegTm(String.format("%06d", (Integer.parseInt(hstEntity1.getLoanRegTm()) + 1)));
212
+                hstEntity2.setDpstPayDvsn(DpstPayDvsn.PAYMENT.getCd());
213
+                hstEntity2.setMediaDvsn(MediaDvsn.SETTLMENT.getCd());
214
+                hstEntity2.setPayType(PayType.STTL_PAY.getCd());
215
+                hstEntity2.setTrscAmt(procEntity.getDpstAmt()); // 거래금액
216
+                hstEntity2.setTrscBfBal(trscBfBal);
217
+                hstEntity2.setTrscAfBal(trscAfBal);
218
+                dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity2);
197 219
             }
198 220
         }
199 221
     }