Переглянути джерело

입금승인 에러 처리

marseyes 2 роки тому
батько
коміт
b6ed277f9e

+ 43 - 52
src/main/java/com/oqpo/api/service/loanmng/DsptMngService.java

@@ -126,59 +126,50 @@ public class DsptMngService extends CommonService {
126 126
     /* 입금승인 */
127 127
     @Transactional
128 128
     public void approveDspt(String userId, ApproveDsptRequest approveDsptRequest) throws Exception {
129
-        try {
130
-            // 사용자 정보 조회
131
-            UserMngEntity user = userMngMapper.selectUserInfo(userId);
132
-
133
-            List<String> list = approveDsptRequest.getDsptMgntNoList();
129
+        // 사용자 정보 조회
130
+        UserMngEntity user = userMngMapper.selectUserInfo(userId);
131
+        List<String> list = approveDsptRequest.getDsptMgntNoList();
132
+
133
+        for (String dsptMgntNo : list) {
134
+            // 여신관리입금처리 데이터 조회
135
+            LoanMgntDsptProcEntity procEntity = dsptMngMapper.selectLoanMgntDsptProcInfo(dsptMgntNo);
136
+
137
+            // 매장의 여신관리기본정보 조회 - 없으면 에러 처리
138
+            LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(procEntity.getBrandId(), procEntity.getStoreId());
139
+
140
+            // 여신관리기본정보 (계좌잔액 증가)
141
+            long trscBfBal = infoEntity.getAcctBal();
142
+            long trscAfBal = infoEntity.getAcctBal() + procEntity.getDpstAmt();
143
+            infoEntity.setAcctBal(trscAfBal); // 계좌잔액
144
+            dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
145
+
146
+            // 여신관리상세이력 등록
147
+            LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
148
+            hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
149
+            hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
150
+            hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
151
+            hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
152
+            hstEntity.setTrscAmt(procEntity.getDpstAmt()); // 거래금액
153
+            hstEntity.setTrscBfBal(trscBfBal);
154
+            hstEntity.setTrscAfBal(trscAfBal);
155
+            hstEntity.setMediaDvsn(MediaDvsn.BANKING.getCd());
156
+            hstEntity.setRcvAcctNo(procEntity.getRcvAcctNo()); // 입금계좌번호 - 매장 송금계좌
157
+            hstEntity.setDpstDt(procEntity.getDpstDt());
158
+            hstEntity.setDpstNm(procEntity.getDpstNm());
159
+            hstEntity.setDpstBnkCd(procEntity.getDpstBnkCd());
160
+            hstEntity.setDsptMgntNo(procEntity.getDsptMgntNo());
161
+            dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
134 162
 
135
-            for (String dsptMgntNo : list) {
136
-                // 여신관리입금처리 데이터 조회
137
-                LoanMgntDsptProcEntity procEntity = dsptMngMapper.selectLoanMgntDsptProcInfo(dsptMgntNo);
138
-
139
-                // 매장의 여신관리기본정보 조회 - 없으면 에러 처리
140
-                LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(procEntity.getBrandId(), procEntity.getStoreId());
141
-
142
-                // 여신관리기본정보 (계좌잔액 증가)
143
-                long trscBfBal = infoEntity.getAcctBal();
144
-                long trscAfBal = infoEntity.getAcctBal() + procEntity.getDpstAmt();
145
-                infoEntity.setAcctBal(trscAfBal); // 계좌잔액
146
-                dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
147
-
148
-                // 여신관리상세이력 등록
149
-                LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
150
-                hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
151
-                hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
152
-                hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
153
-                hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
154
-                hstEntity.setTrscAmt(procEntity.getDpstAmt()); // 거래금액
155
-                hstEntity.setTrscBfBal(trscBfBal);
156
-                hstEntity.setTrscAfBal(trscAfBal);
157
-                hstEntity.setMediaDvsn(MediaDvsn.BANKING.getCd());
158
-                hstEntity.setRcvAcctNo(procEntity.getRcvAcctNo()); // 입금계좌번호 - 매장 송금계좌
159
-                hstEntity.setDpstDt(procEntity.getDpstDt());
160
-                hstEntity.setDpstNm(procEntity.getDpstNm());
161
-                hstEntity.setDpstBnkCd(procEntity.getDpstBnkCd());
162
-                hstEntity.setDsptMgntNo(procEntity.getDsptMgntNo());
163
-                dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
164
-
165
-                // 여신관리입금처리
166
-                LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
167
-                entity.setDsptMgntNo(dsptMgntNo);
168
-                entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd()); // 입금승인
169
-                entity.setDpstAuthId(userId);
170
-                entity.setDpstAuthNm(user.getUserNm());
171
-                entity.setDpstAuthDt(DateUtil.getCurrentDate());
172
-                entity.setDpstAuthTm(DateUtil.getCurrentTime());
173
-                entity.setDpstAuthYn("Y"); // 입금승인여부
174
-                dsptMngMapper.updateLoanMgntDsptProcInfo4Approve(userId, entity);
175
-            }
176
-        } catch (GlobalException e) {
177
-            e.getStackTrace();
178
-            throw new GlobalException(e.getSystemMessageCode());
179
-        } catch (Exception e) {
180
-            e.getStackTrace();
181
-            throw new RuntimeException();
163
+            // 여신관리입금처리
164
+            LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
165
+            entity.setDsptMgntNo(dsptMgntNo);
166
+            entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd()); // 입금승인
167
+            entity.setDpstAuthId(userId);
168
+            entity.setDpstAuthNm(user.getUserNm());
169
+            entity.setDpstAuthDt(DateUtil.getCurrentDate());
170
+            entity.setDpstAuthTm(DateUtil.getCurrentTime());
171
+            entity.setDpstAuthYn("Y"); // 입금승인여부
172
+            dsptMngMapper.updateLoanMgntDsptProcInfo4Approve(userId, entity);
182 173
         }
183 174
     }
184 175