Browse Source

미납금관리

marseyes 2 years ago
parent
commit
e5906f1de3

+ 2 - 0
src/main/java/com/oqpo/api/entity/loanmng/LoanMgntDsptProcEntity.java

@@ -81,5 +81,7 @@ public class LoanMgntDsptProcEntity implements Serializable {
81 81
     @ApiModelProperty(value = "PG사아이디")
82 82
     private String pgId;
83 83
 
84
+    @ApiModelProperty(value = "정산관리고유번호(후불/PG사용안함)")
85
+    private String sttlMgntUnqNo;
84 86
 
85 87
 }

+ 4 - 0
src/main/java/com/oqpo/api/entity/settmng/StlMgntBaseInfoEntity.java

@@ -80,5 +80,9 @@ public class StlMgntBaseInfoEntity implements Serializable {
80 80
 
81 81
     @ApiModelProperty(value = "PG 몰아이디")
82 82
     private String mallId;
83
+    @ApiModelProperty(value = "입금관리번호")
84
+    private String dsptMgntNo;
85
+    @ApiModelProperty(value = "입금상태코드")
86
+    private String dpstStCd;
83 87
 
84 88
 }

+ 24 - 1
src/main/java/com/oqpo/api/service/loanmng/DsptMngService.java

@@ -5,14 +5,17 @@ import com.oqpo.api.entity.loanmng.LoanMgntBaseInfoEntity;
5 5
 import com.oqpo.api.entity.loanmng.LoanMgntDsptProcEntity;
6 6
 import com.oqpo.api.entity.loanmng.LoanMgntDtlHstEntity;
7 7
 import com.oqpo.api.entity.oper.UserMngEntity;
8
+import com.oqpo.api.entity.settmng.StlMgntBaseInfoEntity;
8 9
 import com.oqpo.api.enums.DpstPayDvsn;
9 10
 import com.oqpo.api.enums.DpstStCd;
10 11
 import com.oqpo.api.enums.MediaDvsn;
11 12
 import com.oqpo.api.exception.GlobalException;
12 13
 import com.oqpo.api.mapper.loanmng.DsptMngMapper;
13 14
 import com.oqpo.api.mapper.oper.UserMngMapper;
15
+import com.oqpo.api.mapper.sttlmng.SttlReqMapper;
14 16
 import com.oqpo.api.service.CommonService;
15 17
 import com.oqpo.api.util.DateUtil;
18
+import com.oqpo.api.util.StringUtil;
16 19
 import com.oqpo.api.web.dto.request.GridRequest;
17 20
 import com.oqpo.api.web.dto.request.loanmng.ApproveDsptRequest;
18 21
 import com.oqpo.api.web.dto.request.loanmng.RejectDsptRequest;
@@ -26,6 +29,9 @@ import org.springframework.beans.factory.annotation.Autowired;
26 29
 import org.springframework.stereotype.Service;
27 30
 import org.springframework.transaction.annotation.Transactional;
28 31
 
32
+import java.io.PrintWriter;
33
+import java.io.StringWriter;
34
+import java.io.Writer;
29 35
 import java.util.List;
30 36
 import java.util.stream.Collectors;
31 37
 
@@ -39,6 +45,9 @@ public class DsptMngService extends CommonService {
39 45
     @Autowired
40 46
     private UserMngMapper userMngMapper;
41 47
 
48
+    @Autowired
49
+    private SttlReqMapper sttlReqMapper;
50
+
42 51
     /*
43 52
       입금관리 그리드 리스트 조회
44 53
      */
@@ -115,12 +124,17 @@ public class DsptMngService extends CommonService {
115 124
             entity.setDpstReqNm(user.getUserNm());
116 125
             entity.setStoreId(reqDsptRequest.getStoreId());
117 126
             entity.setBrandId(reqDsptRequest.getBrandId());
127
+            entity.setSttlMgntUnqNo(reqDsptRequest.getSttlMgntUnqNo());     // 정산관리고유번호
118 128
             dsptMngMapper.insertLoanMgntDsptProcInfo(userId, entity);
119 129
         } catch (GlobalException e) {
120 130
             e.getStackTrace();
121 131
             throw new GlobalException(e.getSystemMessageCode());
122 132
         } catch (Exception e) {
123
-            e.getStackTrace();
133
+            // e.getStackTrace();
134
+            Writer buffer = new StringWriter();
135
+            PrintWriter pw = new PrintWriter(buffer);
136
+            e.printStackTrace(pw);
137
+            log.error(buffer.toString());
124 138
             throw new RuntimeException();
125 139
         }
126 140
     }
@@ -172,6 +186,15 @@ public class DsptMngService extends CommonService {
172 186
             entity.setDpstAuthTm(DateUtil.getCurrentTime());
173 187
             entity.setDpstAuthYn("Y"); // 입금승인여부
174 188
             dsptMngMapper.updateLoanMgntDsptProcInfo4Approve(userId, entity);
189
+
190
+            // 정산관리고유번호 처리
191
+            if (!StringUtil.isEmpty(procEntity.getSttlMgntUnqNo())) {
192
+                StlMgntBaseInfoEntity stlEntity = new StlMgntBaseInfoEntity();
193
+                stlEntity.setSttlMgntUnqNo(procEntity.getSttlMgntUnqNo());
194
+                stlEntity.setRcptYn("Y");
195
+                stlEntity.setRcptAmt(procEntity.getDpstAmt());
196
+                sttlReqMapper.updateStlMgntBaseInfo4Rcpt(userId, stlEntity);
197
+            }
175 198
         }
176 199
     }
177 200
 

+ 2 - 0
src/main/java/com/oqpo/api/web/dto/request/loanmng/ReqDsptRequest.java

@@ -23,5 +23,7 @@ public class ReqDsptRequest {
23 23
     private String storeId;
24 24
     @ApiModelProperty(value = "브랜드아이디")
25 25
     private String brandId;
26
+    @ApiModelProperty(value = "정산관리고유번호")
27
+    private String sttlMgntUnqNo;
26 28
 
27 29
 }

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

@@ -71,6 +71,11 @@ public class UnpaidMngInfoResponse {
71 71
     @ApiModelProperty(value = "PG 몰아이디")
72 72
     private String mallId;
73 73
 
74
+    @ApiModelProperty(value = "입금관리번호")
75
+    private String dsptMgntNo;
76
+    @ApiModelProperty(value = "입금상태코드")
77
+    private String dpstStCd;
78
+
74 79
     public static UnpaidMngInfoResponse toDTO(StlMgntBaseInfoEntity entity) {
75 80
         if (entity == null) return null;
76 81
         return UnpaidMngInfoResponse.builder()
@@ -99,6 +104,8 @@ public class UnpaidMngInfoResponse {
99 104
                 .rcptYn(entity.getRcptYn())
100 105
                 .loanDvsn(entity.getLoanDvsn())             /* 여신구분 */
101 106
                 .mallId(entity.getMallId())                 /* PG몰ID */
107
+                .dsptMgntNo(entity.getDsptMgntNo())         /* 입금관리번호 */
108
+                .dpstStCd(entity.getDpstStCd())             /* 입금상태코드 */
102 109
                 .build();
103 110
     }
104 111
 

+ 4 - 3
src/main/resources/mybatis/sqlmaps/loanmng/DsptMng.xml

@@ -92,7 +92,8 @@
92 92
         SELECT A.dspt_mgnt_no, A.req_dt, A.req_tm, A.dpst_amt, A.dpst_dt, A.dpst_nm, A.rcv_acct_no, A.dpst_bnk_cd,
93 93
             A.dpst_st_cd, A.dpst_req_id, A.dpst_req_nm, A.dpst_auth_id, A.dpst_auth_nm, A.dpst_auth_dt, A.dpst_auth_tm, A.dspt_rjct_dt,
94 94
             A.dspt_rjct_tm, A.store_id, A.brand_id, A.dpst_auth_yn, A.dspt_rjct_rsn,
95
-            A.sys_reg_dttm, A.sys_reg_id, A.sys_chg_dttm, A.sys_chg_id
95
+            A.sys_reg_dttm, A.sys_reg_id, A.sys_chg_dttm, A.sys_chg_id,
96
+            A.sttl_mgnt_unq_no      /* 정산관리고유번호 */
96 97
         FROM loan_mgnt_dspt_proc A
97 98
         WHERE A.dspt_mgnt_no = #{dsptMgntNo}
98 99
     </select>
@@ -103,14 +104,14 @@
103 104
             (dspt_mgnt_no, req_dt, req_tm, dpst_amt, dpst_dt, dpst_nm, rcv_acct_no, dpst_bnk_cd, dpst_st_cd, dpst_req_id,
104 105
              dpst_req_nm, dpst_auth_id, dpst_auth_nm, dpst_auth_dt, dpst_auth_tm, dspt_rjct_dt, dspt_rjct_tm,
105 106
              store_id, brand_id, dpst_auth_yn, dspt_rjct_rsn,
106
-             po_ord_no, pg_id,
107
+             po_ord_no, pg_id, sttl_mgnt_unq_no,
107 108
              sys_reg_dttm, sys_reg_id, sys_chg_dttm, sys_chg_id)
108 109
         VALUES
109 110
             (#{entity.dsptMgntNo}, #{entity.reqDt}, #{entity.reqTm}, #{entity.dpstAmt}, #{entity.dpstDt}, #{entity.dpstNm},
110 111
              #{entity.rcvAcctNo}, #{entity.dpstBnkCd}, #{entity.dpstStCd}, #{entity.dpstReqId}, #{entity.dpstReqNm},
111 112
              #{entity.dpstAuthId}, #{entity.dpstAuthNm}, #{entity.dpstAuthDt}, #{entity.dpstAuthTm}, #{entity.dsptRjctDt},
112 113
              #{entity.dsptRjctTm}, #{entity.storeId}, #{entity.brandId}, #{entity.dpstAuthYn}, #{entity.dsptRjctRsn},
113
-             #{entity.poOrdNo}, #{entity.pgId},
114
+             #{entity.poOrdNo}, #{entity.pgId}, #{entity.sttlMgntUnqNo},
114 115
              NOW(), #{userId}, NOW(), #{userId})
115 116
     </insert>
116 117
 

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

@@ -133,20 +133,17 @@
133 133
                 END
134 134
                 END
135 135
                 ELSE '정산대기'
136
-            END AS sttl_add_st_nm,         /* 상태 */
136
+            END AS sttl_add_st_nm,      /* 상태 */
137 137
             ]]>
138
-            stl.sttl_mgnt_unq_no,      /* 정산관리고유번호 */
139
-            stl.rcpt_yn,               /* 수납여부(후불사용) */
138
+            stl.sttl_mgnt_unq_no,       /* 정산관리고유번호 */
139
+            stl.rcpt_yn,                /* 수납여부(후불사용) */
140 140
             DATE_FORMAT(stl.sys_reg_dttm,'%Y.%m.%d %H:%i:%s') AS sys_reg_dttm,
141
-            FN_USER_NM(stl.sys_reg_id) AS sys_reg_nm
141
+            FN_USER_NM(stl.sys_reg_id) AS sys_reg_nm,
142
+            dspt.dspt_mgnt_no, dspt.dpst_st_cd           /* 여신관리번호 */
142 143
         FROM store_base_info store
143
-        INNER JOIN loan_mgnt_base_info loan
144
-        ON store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no
145
-        AND store.loan_dvsn = loan.loan_dvsn
146
-        AND store.store_id = loan.store_id
147
-        INNER JOIN stl_mgnt_base_info stl
148
-        ON store.store_id = stl.store_id
149
-        AND store.brand_id = stl.brand_id
144
+        INNER JOIN loan_mgnt_base_info loan ON store.loan_mgnt_unq_no = loan.loan_mgnt_unq_no AND store.loan_dvsn = loan.loan_dvsn AND store.store_id = loan.store_id
145
+        INNER JOIN stl_mgnt_base_info stl ON store.store_id = stl.store_id AND store.brand_id = stl.brand_id
146
+        LEFT JOIN loan_mgnt_dspt_proc dspt ON stl.sttl_mgnt_unq_no = dspt.sttl_mgnt_unq_no
150 147
         WHERE stl.sttl_mgnt_unq_no = #{sttlMgntUnqNo}
151 148
     </select>
152 149