|
@@ -1,16 +1,22 @@
|
1
|
1
|
package com.oqpo.api.service.loanmng;
|
2
|
2
|
|
3
|
3
|
|
4
|
|
-import com.oqpo.api.entity.stockmng.WhsMgntBaseInfoEntity;
|
5
|
|
-import com.oqpo.api.entity.stockmng.WhsMgntBaseLocEntity;
|
|
4
|
+import com.oqpo.api.entity.loanmng.LoanMgntDsptProcEntity;
|
|
5
|
+import com.oqpo.api.entity.oper.UserMngEntity;
|
|
6
|
+import com.oqpo.api.enums.DpstStCd;
|
6
|
7
|
import com.oqpo.api.exception.GlobalException;
|
7
|
|
-import com.oqpo.api.mapper.stockmng.WhsMngMapper;
|
|
8
|
+import com.oqpo.api.mapper.loanmng.DsptMngMapper;
|
|
9
|
+import com.oqpo.api.mapper.oper.UserMngMapper;
|
8
|
10
|
import com.oqpo.api.service.CommonService;
|
|
11
|
+import com.oqpo.api.util.DateUtil;
|
9
|
12
|
import com.oqpo.api.web.dto.request.GridRequest;
|
10
|
|
-import com.oqpo.api.web.dto.request.stockmng.SaveWhsInfoRequest;
|
|
13
|
+import com.oqpo.api.web.dto.request.loanmng.ApproveDsptRequest;
|
|
14
|
+import com.oqpo.api.web.dto.request.loanmng.RejectDsptRequest;
|
|
15
|
+import com.oqpo.api.web.dto.request.loanmng.RemoveDsptRequest;
|
|
16
|
+import com.oqpo.api.web.dto.request.loanmng.ReqDsptRequest;
|
11
|
17
|
import com.oqpo.api.web.dto.response.GridResponse;
|
12
|
|
-import com.oqpo.api.web.dto.response.stockmng.WhsMngInfoResponse;
|
13
|
|
-import com.oqpo.api.web.dto.response.stockmng.WhsMngListResponse;
|
|
18
|
+import com.oqpo.api.web.dto.response.loanmng.DsptMngInfoResponse;
|
|
19
|
+import com.oqpo.api.web.dto.response.loanmng.DsptMngListResponse;
|
14
|
20
|
import lombok.extern.slf4j.Slf4j;
|
15
|
21
|
import org.springframework.beans.factory.annotation.Autowired;
|
16
|
22
|
import org.springframework.stereotype.Service;
|
|
@@ -24,70 +30,107 @@ import java.util.stream.Collectors;
|
24
|
30
|
public class DsptMngService extends CommonService {
|
25
|
31
|
|
26
|
32
|
@Autowired
|
27
|
|
- private WhsMngMapper whsMngMapper;
|
|
33
|
+ private DsptMngMapper dsptMngMapper;
|
|
34
|
+
|
|
35
|
+ @Autowired
|
|
36
|
+ private UserMngMapper userMngMapper;
|
28
|
37
|
|
29
|
38
|
/*
|
30
|
39
|
입금관리 그리드 리스트 조회
|
31
|
40
|
*/
|
32
|
|
- public GridResponse selectWhsMngGridList(String sBrandId, String sStoreId, String sWhsDvsn, String sWhsStCd,
|
33
|
|
- String sWhsNm, GridRequest gridRequest) throws Exception {
|
|
41
|
+ public GridResponse selectDsptMngGridList(String sBrandId, String sStoreId, String sDpstStCd, String fromDt, String toDt, GridRequest gridRequest) throws Exception {
|
34
|
42
|
int gridPage = gridRequest.getGridPage();
|
35
|
43
|
int gridSize = gridRequest.getGridSize();
|
36
|
44
|
|
37
|
|
- int gridRecords = whsMngMapper.selectWhsMngGridCnt(sBrandId, sStoreId, sWhsDvsn, sWhsStCd, sWhsNm);
|
|
45
|
+ int gridRecords = dsptMngMapper.selectDsptMngGridCnt(sBrandId, sStoreId, sDpstStCd, fromDt, toDt);
|
38
|
46
|
int gridTotal = fnCalculateGridTotal(gridSize, gridRecords);
|
39
|
|
- List<WhsMgntBaseInfoEntity> entities = whsMngMapper.selectWhsMngGridList(sBrandId, sStoreId, sWhsDvsn, sWhsStCd, sWhsNm, gridRequest);
|
|
47
|
+ List<LoanMgntDsptProcEntity> entities = dsptMngMapper.selectDsptMngGridList(sBrandId, sStoreId, sDpstStCd, fromDt, toDt, gridRequest);
|
40
|
48
|
List<Object> gridRows = entities.stream()
|
41
|
|
- .map(m -> WhsMngListResponse.builder()
|
|
49
|
+ .map(m -> DsptMngListResponse.builder()
|
42
|
50
|
.viewCd("R")
|
43
|
|
- .brandId(m.getBrandId())
|
44
|
|
- .brandNm(m.getBrandNm())
|
45
|
|
- .whsId(m.getWhsId())
|
46
|
|
- .whsNm(m.getWhsNm())
|
47
|
|
- .whsDvsn(m.getWhsDvsn())
|
48
|
|
- .whsDvsnNm(m.getWhsDvsnNm())
|
49
|
|
- .mgrNm(m.getMgrNm())
|
50
|
|
- .mgrTelNo(m.getMgrTelNo())
|
51
|
|
- .whsStCd(m.getWhsStCd())
|
52
|
|
- .whsStNm(m.getWhsStNm())
|
|
51
|
+ .dsptMgntNo(m.getDsptMgntNo())
|
|
52
|
+ .reqDt(m.getReqDt())
|
|
53
|
+ .reqTm(m.getReqTm())
|
|
54
|
+ .dpstAmt(m.getDpstAmt())
|
|
55
|
+ .dpstDt(m.getDpstDt())
|
|
56
|
+ .dpstNm(m.getDpstNm())
|
|
57
|
+ .rcvAcctNo(m.getRcvAcctNo())
|
|
58
|
+ .dpstBnkCd(m.getDpstBnkCd())
|
|
59
|
+ .dpstBnkNm(m.getDpstBnkNm())
|
|
60
|
+ .dpstStCd(m.getDpstStCd())
|
|
61
|
+ .dpstStNm(m.getDpstStNm())
|
|
62
|
+ .dpstAuthId(m.getDpstAuthId())
|
|
63
|
+ .dpstAuthNm(m.getDpstAuthNm())
|
|
64
|
+ .dpstAuthDt(m.getDpstAuthDt())
|
|
65
|
+ .dpstAuthTm(m.getDpstAuthTm())
|
|
66
|
+ .dsptRjctDt(m.getDsptRjctDt())
|
|
67
|
+ .dsptRjctTm(m.getDsptRjctTm())
|
53
|
68
|
.storeId(m.getStoreId())
|
54
|
69
|
.storeNm(m.getStoreNm())
|
|
70
|
+ .brandId(m.getBrandId())
|
|
71
|
+ .brandNm(m.getBrandNm())
|
|
72
|
+ .dpstAuthYn(m.getDpstAuthYn())
|
|
73
|
+ .dsptRjctRsn(m.getDsptRjctRsn())
|
55
|
74
|
.build())
|
56
|
75
|
.collect(Collectors.toList());
|
57
|
76
|
return GridResponse.toDTO(gridPage, gridTotal, gridRecords, gridRows);
|
58
|
77
|
}
|
59
|
78
|
|
60
|
79
|
/* 입금관리 정보 조회 */
|
61
|
|
- public WhsMngInfoResponse selectWhsMngInfo(String brandId, String whsId) throws Exception {
|
62
|
|
- WhsMgntBaseInfoEntity entity = whsMngMapper.selectWhsMgntBaseInfo(brandId, whsId);
|
63
|
|
- List<WhsMgntBaseLocEntity> locEntityList = whsMngMapper.selectWhsLocGridList(brandId, whsId);
|
64
|
|
- return WhsMngInfoResponse.toDTO(entity, locEntityList);
|
|
80
|
+ public DsptMngInfoResponse selectDsptMngInfo(String dsptMgntNo) throws Exception {
|
|
81
|
+ LoanMgntDsptProcEntity entity = dsptMngMapper.selectLoanMgntDsptProcInfo(dsptMgntNo);
|
|
82
|
+ return DsptMngInfoResponse.toDTO(entity);
|
65
|
83
|
}
|
66
|
84
|
|
67
|
|
- /* 입금요청 */
|
|
85
|
+ /* 신규입금 요청 */
|
68
|
86
|
@Transactional
|
69
|
|
- public void addWhsInfo(String userId, SaveWhsInfoRequest saveWhsInfoRequest) throws Exception {
|
|
87
|
+ public void requestDspt(String userId, ReqDsptRequest reqDsptRequest) throws Exception {
|
70
|
88
|
try {
|
71
|
|
- // 입금관리기본정보
|
72
|
|
- WhsMgntBaseInfoEntity entity = new WhsMgntBaseInfoEntity();
|
73
|
|
- entity.setBrandId(saveWhsInfoRequest.getBrandId());
|
74
|
|
- entity.setWhsId(fnGetDealNo(28, "")); // 창고아이디 채번
|
75
|
|
- entity.setWhsNm(saveWhsInfoRequest.getWhsNm());
|
76
|
|
- entity.setWhsDvsn(saveWhsInfoRequest.getWhsDvsn());
|
77
|
|
- entity.setMgrNm(saveWhsInfoRequest.getMgrNm());
|
78
|
|
- entity.setMgrTelNo(saveWhsInfoRequest.getMgrTelNo());
|
79
|
|
- entity.setZipNo(saveWhsInfoRequest.getZipNo());
|
80
|
|
- entity.setAddr1(saveWhsInfoRequest.getAddr1());
|
81
|
|
- entity.setAddr2(saveWhsInfoRequest.getAddr2());
|
82
|
|
- entity.setWhsStCd(saveWhsInfoRequest.getWhsStCd());
|
83
|
|
- entity.setStoreId(saveWhsInfoRequest.getStoreId());
|
84
|
|
- whsMngMapper.insertWhsMgntBaseInfo(userId, entity);
|
85
|
|
-
|
86
|
|
- // 창고로케이션정보
|
87
|
|
- List<WhsMgntBaseLocEntity> locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridInsertData());
|
88
|
|
- for (WhsMgntBaseLocEntity locEntity : locEntities) {
|
89
|
|
- whsMngMapper.insertWhsMgntBaseLoc(userId, locEntity);
|
90
|
|
- }
|
|
89
|
+ // 사용자 정보 조회
|
|
90
|
+ UserMngEntity user = userMngMapper.selectUserInfo(userId);
|
|
91
|
+
|
|
92
|
+ // 여신관리입금처리
|
|
93
|
+ LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
|
|
94
|
+ entity.setDsptMgntNo(fnGetDealNo(21, "")); // 입금관리번호
|
|
95
|
+ entity.setReqDt(DateUtil.getCurrentDate());
|
|
96
|
+ entity.setReqTm(DateUtil.getCurrentTime());
|
|
97
|
+ entity.setDpstAmt(reqDsptRequest.getDpstAmt());
|
|
98
|
+ entity.setDpstDt(reqDsptRequest.getDpstDt());
|
|
99
|
+ entity.setDpstNm(reqDsptRequest.getDpstNm());
|
|
100
|
+ entity.setRcvAcctNo(reqDsptRequest.getRcvAcctNo());
|
|
101
|
+ entity.setDpstBnkCd(reqDsptRequest.getDpstBnkCd());
|
|
102
|
+ entity.setDpstStCd(DpstStCd.DPST_REQ.getCd());
|
|
103
|
+ entity.setDpstReqId(userId);
|
|
104
|
+ entity.setDpstReqNm(user.getUserNm());
|
|
105
|
+ entity.setStoreId(reqDsptRequest.getStoreId());
|
|
106
|
+ entity.setBrandId(reqDsptRequest.getBrandId());
|
|
107
|
+ dsptMngMapper.insertLoanMgntDsptProcInfo(userId, entity);
|
|
108
|
+ } catch (GlobalException e) {
|
|
109
|
+ e.getStackTrace();
|
|
110
|
+ throw new GlobalException(e.getSystemMessageCode());
|
|
111
|
+ } catch (Exception e) {
|
|
112
|
+ e.getStackTrace();
|
|
113
|
+ throw new RuntimeException();
|
|
114
|
+ }
|
|
115
|
+ }
|
|
116
|
+
|
|
117
|
+ /* 입금승인 */
|
|
118
|
+ @Transactional
|
|
119
|
+ public void approveDspt(String userId, ApproveDsptRequest approveDsptRequest) throws Exception {
|
|
120
|
+ try {
|
|
121
|
+ // 사용자 정보 조회
|
|
122
|
+ UserMngEntity user = userMngMapper.selectUserInfo(userId);
|
|
123
|
+
|
|
124
|
+ // 여신관리입금처리
|
|
125
|
+ LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
|
|
126
|
+ entity.setDsptMgntNo(approveDsptRequest.getDsptMgntNo());
|
|
127
|
+ entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd()); // 입금승인
|
|
128
|
+ entity.setDpstAuthId(userId);
|
|
129
|
+ entity.setDpstAuthNm(user.getUserNm());
|
|
130
|
+ entity.setDpstAuthDt(DateUtil.getCurrentDate());
|
|
131
|
+ entity.setDpstAuthTm(DateUtil.getCurrentTime());
|
|
132
|
+ entity.setDpstAuthYn("Y"); // 입금승인여부
|
|
133
|
+ dsptMngMapper.updateLoanMgntDsptProcInfo4Approve(userId, entity);
|
91
|
134
|
} catch (GlobalException e) {
|
92
|
135
|
e.getStackTrace();
|
93
|
136
|
throw new GlobalException(e.getSystemMessageCode());
|
|
@@ -97,41 +140,19 @@ public class DsptMngService extends CommonService {
|
97
|
140
|
}
|
98
|
141
|
}
|
99
|
142
|
|
100
|
|
- /* 창고정보 수정 */
|
|
143
|
+ /* 입금반려 */
|
101
|
144
|
@Transactional
|
102
|
|
- public void modifyWhsInfo(String userId, SaveWhsInfoRequest saveWhsInfoRequest) throws Exception {
|
|
145
|
+ public void rejectDspt(String userId, RejectDsptRequest rejectDsptRequest) throws Exception {
|
103
|
146
|
try {
|
104
|
|
- // 입금관리기본정보
|
105
|
|
- WhsMgntBaseInfoEntity entity = new WhsMgntBaseInfoEntity();
|
106
|
|
- entity.setBrandId(saveWhsInfoRequest.getBrandId());
|
107
|
|
- entity.setWhsId(saveWhsInfoRequest.getWhsId());
|
108
|
|
- entity.setWhsNm(saveWhsInfoRequest.getWhsNm());
|
109
|
|
- entity.setWhsDvsn(saveWhsInfoRequest.getWhsDvsn());
|
110
|
|
- entity.setMgrNm(saveWhsInfoRequest.getMgrNm());
|
111
|
|
- entity.setMgrTelNo(saveWhsInfoRequest.getMgrTelNo());
|
112
|
|
- entity.setZipNo(saveWhsInfoRequest.getZipNo());
|
113
|
|
- entity.setAddr1(saveWhsInfoRequest.getAddr1());
|
114
|
|
- entity.setAddr2(saveWhsInfoRequest.getAddr2());
|
115
|
|
- entity.setWhsStCd(saveWhsInfoRequest.getWhsStCd());
|
116
|
|
- entity.setStoreId(saveWhsInfoRequest.getStoreId());
|
117
|
|
- whsMngMapper.updateWhsMgntBaseInfo(userId, entity);
|
118
|
|
-
|
119
|
|
- // 창고로케이션정보
|
120
|
|
- // 삭제
|
121
|
|
- List<WhsMgntBaseLocEntity> locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridDeleteData());
|
122
|
|
- for (WhsMgntBaseLocEntity locEntity : locEntities) {
|
123
|
|
- whsMngMapper.deleteWhsMgntBaseLoc(userId, locEntity);
|
124
|
|
- }
|
125
|
|
- // 수정
|
126
|
|
- locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridUpdateData());
|
127
|
|
- for (WhsMgntBaseLocEntity locEntity : locEntities) {
|
128
|
|
- whsMngMapper.updateWhsMgntBaseLoc(userId, locEntity);
|
129
|
|
- }
|
130
|
|
- // 등록
|
131
|
|
- locEntities = saveWhsInfoRequest.toEntities(saveWhsInfoRequest.getGridInsertData());
|
132
|
|
- for (WhsMgntBaseLocEntity locEntity : locEntities) {
|
133
|
|
- whsMngMapper.insertWhsMgntBaseLoc(userId, locEntity);
|
134
|
|
- }
|
|
147
|
+ // 여신관리입금처리
|
|
148
|
+ LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
|
|
149
|
+ entity.setDsptMgntNo(rejectDsptRequest.getDsptMgntNo());
|
|
150
|
+ entity.setDpstStCd(DpstStCd.DPST_REJECT.getCd()); // 입금반려
|
|
151
|
+ entity.setDsptRjctDt(DateUtil.getCurrentDate());
|
|
152
|
+ entity.setDsptRjctTm(DateUtil.getCurrentTime());
|
|
153
|
+ entity.setDsptRjctRsn(rejectDsptRequest.getDsptRjctRsn());
|
|
154
|
+ entity.setDpstAuthYn("N"); // 입금승인여부
|
|
155
|
+ dsptMngMapper.updateLoanMgntDsptProcInfo4Reject(userId, entity);
|
135
|
156
|
} catch (GlobalException e) {
|
136
|
157
|
e.getStackTrace();
|
137
|
158
|
throw new GlobalException(e.getSystemMessageCode());
|
|
@@ -141,18 +162,14 @@ public class DsptMngService extends CommonService {
|
141
|
162
|
}
|
142
|
163
|
}
|
143
|
164
|
|
144
|
|
- /* 창고정보 삭제 */
|
|
165
|
+ /* 입금요청 삭제 */
|
145
|
166
|
@Transactional
|
146
|
|
- public void removeWhsInfo(String userId, SaveWhsInfoRequest saveWhsInfoRequest) throws Exception {
|
|
167
|
+ public void removeDspt(String userId, RemoveDsptRequest removeDsptRequest) throws Exception {
|
147
|
168
|
try {
|
148
|
|
- // 입금관리기본정보
|
149
|
|
- WhsMgntBaseInfoEntity entity = new WhsMgntBaseInfoEntity();
|
150
|
|
- entity.setBrandId(saveWhsInfoRequest.getBrandId());
|
151
|
|
- entity.setWhsId(saveWhsInfoRequest.getWhsId());
|
152
|
|
- whsMngMapper.deleteWhsMgntBaseInfo(userId, entity);
|
153
|
|
-
|
154
|
|
- // 창고로케이션정보
|
155
|
|
- whsMngMapper.deleteWhsMgntBaseLoc4Info(userId, entity);
|
|
169
|
+ // 여신관리입금처리
|
|
170
|
+ LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
|
|
171
|
+ entity.setDsptMgntNo(removeDsptRequest.getDsptMgntNo());
|
|
172
|
+ dsptMngMapper.deleteLoanMgntDsptProcInfo(userId, entity);
|
156
|
173
|
} catch (GlobalException e) {
|
157
|
174
|
e.getStackTrace();
|
158
|
175
|
throw new GlobalException(e.getSystemMessageCode());
|