Sfoglia il codice sorgente

미납금관리 정보 수정

marseyes 2 anni fa
parent
commit
2c4f40be24

+ 4 - 0
src/main/java/com/oqpo/api/web/dto/response/loanmng/UnpaidMngInfoResponse.java

@@ -57,6 +57,9 @@ public class UnpaidMngInfoResponse {
57 57
     @ApiModelProperty(value = "계좌잔액")
58 58
     private Long acctBal;
59 59
 
60
+    @ApiModelProperty(value = "사용가능한도")
61
+    private Long useAmtTotal;
62
+
60 63
     public static UnpaidMngInfoResponse toDTO(StlMgntBaseInfoEntity entity) {
61 64
         if (entity == null) return null;
62 65
         return UnpaidMngInfoResponse.builder()
@@ -77,6 +80,7 @@ public class UnpaidMngInfoResponse {
77 80
                 .sysRegId(entity.getSysRegId())
78 81
                 .sysChgDttm(entity.getSysChgDttm())
79 82
                 .sysChgId(entity.getSysChgId())
83
+                .useAmtTotal(entity.getUseAmtTotal())
80 84
                 .build();
81 85
     }
82 86
 

+ 41 - 11
src/main/resources/mybatis/sqlmaps/loanmng/UnpaidMng.xml

@@ -96,17 +96,47 @@
96 96
 
97 97
     <select id="selectStlMgntBaseInfo" resultType="com.oqpo.api.entity.settmng.StlMgntBaseInfoEntity">
98 98
         /* UnpaidMngMapper.selectStlMgntBaseInfo */
99
-        SELECT A.sttl_mgnt_unq_no,
100
-            DATE_FORMAT(A.sttl_req_dt, '%Y.%m.%d') AS sttl_req_dt,
101
-            A.store_id, FN_STORE_NM(A.brand_id, A.store_id) AS store_nm,
102
-            A.brand_id, FN_BRAND_NM(A.brand_id) AS brand_nm,
103
-            A.sttl_st_cd, FN_CODE_NM('STTL_ST_CD', A.sttl_st_cd) AS sttl_st_nm, A.sttl_req_amt,
104
-            DATE_FORMAT(A.sttl_dt, '%Y.%m.%d') AS sttl_dt,
105
-            A.sttl_amt, A.sttl_reg_mgr_nm, A.sttl_reg_mgr_id,
106
-            DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm, A.sys_reg_id, FN_USER_NM(A.sys_reg_id) AS sys_reg_nm,
107
-            DATE_FORMAT(A.sys_chg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_chg_dttm, A.sys_chg_id
108
-        FROM stl_mgnt_base_info A
109
-        WHERE A.sttl_mgnt_unq_no = #{sttlMgntUnqNo}
99
+        SELECT store.store_id, store.store_nm, store.brand_id, FN_BRAND_NM(store.brand_id) AS brand_nm,
100
+            store.sttl_req_cfrm_term,       /* 정산요청확인기간 */
101
+            store.sttl_rcp_amt_term,        /* 정산대금입금기간 */
102
+            loan.loan_mgnt_unq_no,          /* 여신관리고유번호 */
103
+            loan.loan_dvsn, FN_CODE_NM('LOAN_DVSN', loan.loan_dvsn) AS loan_dvsn_nm,       /* 여신구분(정산타입) */
104
+            loan.credt_limit_amt - loan.use_amt_total + loan.acct_bal + loan.tmp_rcv_acct_total AS use_amt_total,    /* 사용가능한도 */
105
+            loan.acct_bal,              /* 계좌잔액 */
106
+            loan.credt_limit_amt,       /* 신용한도금액(후불) */
107
+            loan.tmp_rcv_acct_total,    /* 가수금액합계(선결제) */
108
+            DATE_FORMAT(stl.sttl_req_dt, '%Y.%m.%d') AS sttl_req_dt,        /* 정산요청일자 */
109
+            stl.sttl_req_amt,           /* 정산요청금액 */
110
+            DATE_FORMAT(stl.sttl_dt, '%Y.%m.%d') AS sttl_dt,                /* 정산확인일자 */
111
+            <![CDATA[
112
+            CASE WHEN store.sttl_req_cfrm_term > 0 AND store.sttl_rcp_amt_term > 0 THEN
113
+                    CASE WHEN stl.sttl_req_dt IS NULL THEN '정산요청전'
114
+                    ELSE CASE WHEN stl.sttl_dt IS NULL
115
+                    THEN CASE WHEN ADDDATE(DATE_FORMAT(stl.sttl_req_dt, '%Y%m%d'), store.sttl_req_cfrm_term) < DATE_FORMAT(now(), '%Y-%m-%d')
116
+                    THEN CASE WHEN ADDDATE(DATE_FORMAT(stl.sttl_req_dt, '%Y%m%d'), store.sttl_req_cfrm_term + store.sttl_rcp_amt_term) < DATE_FORMAT(NOW(), '%Y-%m-%d')
117
+                    THEN '정산미납'
118
+                    ELSE '정산대기' END
119
+                ELSE '정산미확인' END
120
+                ELSE CASE WHEN ADDDATE(DATE_FORMAT(stl.sttl_dt, '%Y%m%d'), store.sttl_rcp_amt_term) < DATE_FORMAT(NOW(), '%Y-%m-%d')
121
+                THEN '정산미납'
122
+                ELSE '정산대기' END
123
+                END
124
+                END
125
+                ELSE '정산대기'
126
+            END AS sttl_st_nm,         /* 상태 */
127
+            ]]>
128
+            stl.sttl_mgnt_unq_no,      /* 정산관리고유번호 */
129
+            DATE_FORMAT(A.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm,
130
+            FN_USER_NM(A.sys_reg_id) AS sys_reg_nm
131
+        FROM store_base_info store
132
+        INNER JOIN loan_mgnt_base_info loan
133
+        ON store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no
134
+        AND store.loan_dvsn = loan.loan_dvsn
135
+        AND store.store_id = loan.store_id
136
+        INNER JOIN stl_mgnt_base_info stl
137
+        ON store.store_id = stl.store_id
138
+        AND store.brand_id = stl.brand_id
139
+        WHERE stl.sttl_mgnt_unq_no = #{sttlMgntUnqNo}
110 140
     </select>
111 141
 
112 142
     <select id="selectStlMgntDtlPtclList" resultType="com.oqpo.api.entity.settmng.StlMgntDtlPtclEntity">