Commit 639dce5466dcb390f4bcf90b6412990c8772d194
1 parent
a45ecedc
* 로그파일 뷰어
전송된 경로의 파일 마지막 50 줄 읽어서 반한하는 api readlogs { "filePath": "D://logs/localhost_access_log.2019-03-26.txt", "readCnt": "50" } * 자동매칭, EX 일치번호 유니크하게. => 자동매칭은 일치유형별 병렬처리라 유형+순번 으로 그대로 두고 => EX 매칭 만 일치번호 유니크하게 => EX 매칭 매칭순번 start with 10001 * 매칭제외 create 서비스 내 batch_tbcr_inner_delng 초기화 이후 바로 실행 1. 거래금액 = 0 2. 거래유형, 자기/상대 법인, 거래일자, 계정 이 같은 1:1 내역 금액이 +, - 로 합이 0 인 경우 MTCH_SYS = 'EXCLUSION' MTCH_TY = 'EXCLUSION' MTCH_TY_NM = 'EXCLUSION' * 오타, 미사용 참조 등 수정
Showing
12 changed files
with
782 additions
and
656 deletions
Show diff stats
src/main/java/com/batch/config/BatchMatchingConfig.java
@@ -20,13 +20,10 @@ import org.springframework.batch.item.support.ListItemReader; | @@ -20,13 +20,10 @@ import org.springframework.batch.item.support.ListItemReader; | ||
20 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
21 | import org.springframework.context.annotation.Bean; | 21 | import org.springframework.context.annotation.Bean; |
22 | import org.springframework.context.annotation.Configuration; | 22 | import org.springframework.context.annotation.Configuration; |
23 | -import org.springframework.core.task.SimpleAsyncTaskExecutor; | ||
24 | import org.springframework.transaction.PlatformTransactionManager; | 23 | import org.springframework.transaction.PlatformTransactionManager; |
25 | 24 | ||
26 | import com.batch.mapper.primary.MatchingInnerDelingMapper; | 25 | import com.batch.mapper.primary.MatchingInnerDelingMapper; |
27 | 26 | ||
28 | -import org.springframework.batch.integration.async.AsyncItemProcessor; | ||
29 | - | ||
30 | import lombok.extern.slf4j.Slf4j; | 27 | import lombok.extern.slf4j.Slf4j; |
31 | 28 | ||
32 | @Configuration | 29 | @Configuration |
src/main/java/com/batch/config/MatchingExtraProcessorAuto.java
@@ -9,7 +9,6 @@ import java.util.List; | @@ -9,7 +9,6 @@ import java.util.List; | ||
9 | import java.util.Map; | 9 | import java.util.Map; |
10 | import java.util.UUID; | 10 | import java.util.UUID; |
11 | 11 | ||
12 | -import org.springframework.batch.core.configuration.annotation.StepScope; | ||
13 | 12 | ||
14 | import com.batch.mapper.primary.MatchingInnerDelingMapper; | 13 | import com.batch.mapper.primary.MatchingInnerDelingMapper; |
15 | import com.batch.util.StatisticsUtil; | 14 | import com.batch.util.StatisticsUtil; |
@@ -23,220 +22,227 @@ public class MatchingExtraProcessorAuto { | @@ -23,220 +22,227 @@ public class MatchingExtraProcessorAuto { | ||
23 | 22 | ||
24 | private final MatchingInnerDelingMapper matchingInnerDelingMapper; | 23 | private final MatchingInnerDelingMapper matchingInnerDelingMapper; |
25 | 24 | ||
26 | - @SuppressWarnings("unchecked") | ||
27 | - public void process(Map paramRec, int iCmbnOwnCnt, int iCmbnTranCnt, int iStartOwn, int iStartTran, int mtchNumber) throws Exception { | ||
28 | - | ||
29 | - //Job Create Log | ||
30 | - UUID uuid = UUID.randomUUID(); | ||
31 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
32 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
33 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
34 | - | ||
35 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
36 | - paramLog.put("user_job_id", sDate); | ||
37 | - paramLog.put("user_job_name", "자동조합매칭(" + paramRec.toString() + ",[" + iCmbnOwnCnt + "," + iStartOwn + "],[" + iCmbnTranCnt + "," + iStartTran + "])"); | ||
38 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
39 | - | ||
40 | - | ||
41 | - int iUpdated = 0; | ||
42 | - | ||
43 | - String sSysSe = (String) paramRec.get("sys_se"); | ||
44 | - String sAccnutYm = (String) paramRec.get("accnut_ym"); | ||
45 | - String sCprCode = (String) paramRec.get("cpr_code"); | ||
46 | - String sPartCpr = (String) paramRec.get("partn_cpr"); | ||
47 | - String sDelngCrncy = (String) paramRec.get("delng_crncy"); | ||
48 | - String sConds = (String) paramRec.get("conds"); | ||
49 | - | ||
50 | - //작업시작 | ||
51 | - Map<String, Object> mParam = new HashMap<String, Object>(); | ||
52 | - mParam.put("sysSe", sSysSe); | ||
53 | - mParam.put("accnutYm", sAccnutYm); | ||
54 | - mParam.put("conds", sConds); | ||
55 | - mParam.put("delngCrncy", sDelngCrncy); | ||
56 | - | ||
57 | - //---------------------------------------------------------------------------- | ||
58 | - //자기법인 데이타 가져오기 | ||
59 | - mParam.put("cprCode", sCprCode); | ||
60 | - mParam.put("partnCpr", sPartCpr); | ||
61 | - List<Map> lMatchingDataOne = matchingInnerDelingMapper.getMatchingExtraDataOne(mParam); | ||
62 | - | ||
63 | - //상대법인 데이타 가져오기 | ||
64 | - mParam.put("cprCode", sPartCpr); | ||
65 | - mParam.put("partnCpr", sCprCode); | ||
66 | - List<Map> lMatchingDataTwo = matchingInnerDelingMapper.getMatchingExtraDataTwo(mParam); | ||
67 | - | ||
68 | - //Combination 데이타 만들기 | 25 | + @SuppressWarnings({ "unchecked", "rawtypes" }) |
26 | + public long process(Map paramRec, int iCmbnOwnCnt, int iCmbnTranCnt, int iStartOwn, int iStartTran, long mtchNumber) throws Exception { | ||
27 | + | ||
28 | + // Job Create Log | ||
29 | + UUID uuid = UUID.randomUUID(); | ||
30 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
31 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
32 | + | ||
33 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
34 | + paramLog.put("user_job_id", sDate); | ||
35 | + paramLog.put("user_job_name", "자동조합매칭(" + paramRec.toString() + ",[" + iCmbnOwnCnt + "," + iStartOwn + "],[" + iCmbnTranCnt + "," + iStartTran + "])"); | ||
36 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
37 | + | ||
38 | + int iUpdated = 0; | ||
39 | + | ||
40 | + String sSysSe = (String) paramRec.get("sys_se"); | ||
41 | + String sAccnutYm = (String) paramRec.get("accnut_ym"); | ||
42 | + String sCprCode = (String) paramRec.get("cpr_code"); | ||
43 | + String sPartCpr = (String) paramRec.get("partn_cpr"); | ||
44 | + String sDelngCrncy = (String) paramRec.get("delng_crncy"); | ||
45 | + String sConds = (String) paramRec.get("conds"); | ||
46 | + | ||
47 | + // 작업시작 | ||
48 | + Map<String, Object> mParam = new HashMap<String, Object>(); | ||
49 | + mParam.put("sysSe", sSysSe); | ||
50 | + mParam.put("accnutYm", sAccnutYm); | ||
51 | + mParam.put("conds", sConds); | ||
52 | + mParam.put("delngCrncy", sDelngCrncy); | ||
53 | + | ||
54 | + // ---------------------------------------------------------------------------- | ||
55 | + // 자기법인 데이타 가져오기 | ||
56 | + mParam.put("cprCode", sCprCode); | ||
57 | + mParam.put("partnCpr", sPartCpr); | ||
58 | + List<Map> lMatchingDataOne = matchingInnerDelingMapper.getMatchingExtraDataOne(mParam); | ||
59 | + | ||
60 | + // 상대법인 데이타 가져오기 | ||
61 | + mParam.put("cprCode", sPartCpr); | ||
62 | + mParam.put("partnCpr", sCprCode); | ||
63 | + List<Map> lMatchingDataTwo = matchingInnerDelingMapper.getMatchingExtraDataTwo(mParam); | ||
64 | + | ||
65 | + // Combination 데이타 만들기 | ||
69 | List<Map> compResult = new ArrayList<Map>(); | 66 | List<Map> compResult = new ArrayList<Map>(); |
70 | List<List<Map>> llMatchingDataOne = new ArrayList<List<Map>>(); | 67 | List<List<Map>> llMatchingDataOne = new ArrayList<List<Map>>(); |
71 | List<List<Map>> llMatchingDataTwo = new ArrayList<List<Map>>(); | 68 | List<List<Map>> llMatchingDataTwo = new ArrayList<List<Map>>(); |
72 | - | 69 | + |
73 | int iEndOwn = lMatchingDataOne.size(); | 70 | int iEndOwn = lMatchingDataOne.size(); |
74 | if (iCmbnOwnCnt == 2) { | 71 | if (iCmbnOwnCnt == 2) { |
75 | iEndOwn = iStartOwn + 1000; | 72 | iEndOwn = iStartOwn + 1000; |
76 | - if (iEndOwn > lMatchingDataOne.size()) iEndOwn = lMatchingDataOne.size(); | 73 | + if (iEndOwn > lMatchingDataOne.size()) |
74 | + iEndOwn = lMatchingDataOne.size(); | ||
77 | } | 75 | } |
78 | if (iCmbnOwnCnt == 3) { | 76 | if (iCmbnOwnCnt == 3) { |
79 | iEndOwn = iStartOwn + 50; | 77 | iEndOwn = iStartOwn + 50; |
80 | - if (iEndOwn > lMatchingDataOne.size()) iEndOwn = lMatchingDataOne.size(); | 78 | + if (iEndOwn > lMatchingDataOne.size()) |
79 | + iEndOwn = lMatchingDataOne.size(); | ||
81 | } | 80 | } |
82 | if (iCmbnOwnCnt > 3) { | 81 | if (iCmbnOwnCnt > 3) { |
83 | iEndOwn = iStartOwn + 25; | 82 | iEndOwn = iStartOwn + 25; |
84 | - if (iEndOwn > lMatchingDataOne.size()) iEndOwn = lMatchingDataOne.size(); | 83 | + if (iEndOwn > lMatchingDataOne.size()) |
84 | + iEndOwn = lMatchingDataOne.size(); | ||
85 | } | 85 | } |
86 | 86 | ||
87 | int iEndTran = lMatchingDataTwo.size(); | 87 | int iEndTran = lMatchingDataTwo.size(); |
88 | if (iCmbnTranCnt == 2) { | 88 | if (iCmbnTranCnt == 2) { |
89 | iEndTran = iStartTran + 1000; | 89 | iEndTran = iStartTran + 1000; |
90 | - if (iEndTran > lMatchingDataTwo.size()) iEndTran = lMatchingDataTwo.size(); | 90 | + if (iEndTran > lMatchingDataTwo.size()) |
91 | + iEndTran = lMatchingDataTwo.size(); | ||
91 | } | 92 | } |
92 | if (iCmbnTranCnt == 3) { | 93 | if (iCmbnTranCnt == 3) { |
93 | iEndTran = iStartTran + 50; | 94 | iEndTran = iStartTran + 50; |
94 | - if (iEndTran > lMatchingDataTwo.size()) iEndTran = lMatchingDataTwo.size(); | 95 | + if (iEndTran > lMatchingDataTwo.size()) |
96 | + iEndTran = lMatchingDataTwo.size(); | ||
95 | } | 97 | } |
96 | if (iCmbnTranCnt > 3) { | 98 | if (iCmbnTranCnt > 3) { |
97 | iEndTran = iStartTran + 25; | 99 | iEndTran = iStartTran + 25; |
98 | - if (iEndTran > lMatchingDataTwo.size()) iEndTran = lMatchingDataTwo.size(); | 100 | + if (iEndTran > lMatchingDataTwo.size()) |
101 | + iEndTran = lMatchingDataTwo.size(); | ||
102 | + } | ||
103 | + | ||
104 | + StatisticsUtil.reculsion(lMatchingDataOne, compResult, iStartOwn, iEndOwn, iCmbnOwnCnt, llMatchingDataOne); | ||
105 | + StatisticsUtil.reculsion(lMatchingDataTwo, compResult, iStartTran, iEndTran, iCmbnTranCnt, llMatchingDataTwo); | ||
106 | + | ||
107 | + // ---------------------------------------------------------------------------- | ||
108 | + // 자기법인 데이타를 맵으로 처리한다. | ||
109 | + Map<BigDecimal, List<List<Map>>> mMatchingDataOne = new HashMap<BigDecimal, List<List<Map>>>(); | ||
110 | + for (List<Map> curlMap : llMatchingDataOne) { | ||
111 | + BigDecimal bdKey = BigDecimal.ZERO; | ||
112 | + for (Map curMap : curlMap) { | ||
113 | + bdKey = bdKey.add((BigDecimal) curMap.get("delng_amt")); | ||
114 | + } | ||
115 | + List<List<Map>> curllMap = new ArrayList<List<Map>>(); | ||
116 | + if (mMatchingDataOne.containsKey(bdKey)) | ||
117 | + curllMap = mMatchingDataOne.get(bdKey); | ||
118 | + curllMap.add(curlMap); | ||
119 | + mMatchingDataOne.put(bdKey, curllMap); | ||
99 | } | 120 | } |
100 | - | ||
101 | - StatisticsUtil.reculsion(lMatchingDataOne, compResult, iStartOwn, iEndOwn, iCmbnOwnCnt, llMatchingDataOne); | ||
102 | - StatisticsUtil.reculsion(lMatchingDataTwo, compResult, iStartTran, iEndTran, iCmbnTranCnt, llMatchingDataTwo); | ||
103 | - | ||
104 | - //---------------------------------------------------------------------------- | ||
105 | - //자기법인 데이타를 맵으로 처리한다. | ||
106 | - Map<BigDecimal, List<List<Map>>> mMatchingDataOne = new HashMap<BigDecimal, List<List<Map>>>(); | ||
107 | - for (List<Map> curlMap : llMatchingDataOne) { | ||
108 | - BigDecimal bdKey = BigDecimal.ZERO; | ||
109 | - for(Map curMap : curlMap) { | ||
110 | - bdKey = bdKey.add((BigDecimal) curMap.get("delng_amt")); | ||
111 | - } | ||
112 | - List<List<Map>> curllMap = new ArrayList<List<Map>>(); | ||
113 | - if (mMatchingDataOne.containsKey(bdKey)) curllMap = mMatchingDataOne.get(bdKey); | ||
114 | - curllMap.add(curlMap); | ||
115 | - mMatchingDataOne.put(bdKey, curllMap); | ||
116 | - } | ||
117 | - | ||
118 | - //상대법인 데이타를 맵으로 처리한다. | ||
119 | - Map<BigDecimal, List<List<Map>>> mMatchingDataTwo = new HashMap<BigDecimal, List<List<Map>>>(); | ||
120 | - for (List<Map> curlMap : llMatchingDataTwo) { | ||
121 | - BigDecimal bdKey = BigDecimal.ZERO; | ||
122 | - for(Map curMap : curlMap) { | ||
123 | - bdKey = bdKey.add((BigDecimal) curMap.get("delng_amt")); | ||
124 | - } | ||
125 | - List<List<Map>> curllMap = new ArrayList<List<Map>>(); | ||
126 | - if (mMatchingDataTwo.containsKey(bdKey)) curllMap = mMatchingDataTwo.get(bdKey); | ||
127 | - curllMap.add(curlMap); | ||
128 | - mMatchingDataTwo.put(bdKey, curllMap); | ||
129 | - } | ||
130 | - | ||
131 | - //여기서 매칭 비교 | ||
132 | - //비교 lMatchingDataOne vs mMatchingDataTwo | ||
133 | - List<Map> lMatchingResultUpdate = new ArrayList<Map>(); //업데이트할 대상 | ||
134 | - | ||
135 | - String mtchSys = "AUTO"; | ||
136 | - String mtchType = "EX_" + iCmbnOwnCnt + "_" + iCmbnTranCnt; | ||
137 | - String mtchTypeName = "자기(" + iCmbnOwnCnt + "건Sum), 상대(" + iCmbnTranCnt + "건Sum), ("+sDelngCrncy+"), 비교(금액)"; | ||
138 | - for (BigDecimal curKey : mMatchingDataOne.keySet()) { | ||
139 | - if (mMatchingDataTwo.containsKey(curKey)) { | ||
140 | - List<List<Map>> llMapOne = mMatchingDataOne.get(curKey); | ||
141 | - List<List<Map>> llMapTwo = mMatchingDataTwo.get(curKey); | ||
142 | - | ||
143 | - //위와 관련된 동일 레코드가 있는 리스트 삭제 | ||
144 | - for (int i=llMapOne.size()-1; i>=0;i--) { | ||
145 | - List<Map> curlMap = llMapOne.get(i); | 121 | + |
122 | + // 상대법인 데이타를 맵으로 처리한다. | ||
123 | + Map<BigDecimal, List<List<Map>>> mMatchingDataTwo = new HashMap<BigDecimal, List<List<Map>>>(); | ||
124 | + for (List<Map> curlMap : llMatchingDataTwo) { | ||
125 | + BigDecimal bdKey = BigDecimal.ZERO; | ||
126 | + for (Map curMap : curlMap) { | ||
127 | + bdKey = bdKey.add((BigDecimal) curMap.get("delng_amt")); | ||
128 | + } | ||
129 | + List<List<Map>> curllMap = new ArrayList<List<Map>>(); | ||
130 | + if (mMatchingDataTwo.containsKey(bdKey)) | ||
131 | + curllMap = mMatchingDataTwo.get(bdKey); | ||
132 | + curllMap.add(curlMap); | ||
133 | + mMatchingDataTwo.put(bdKey, curllMap); | ||
134 | + } | ||
135 | + | ||
136 | + // 여기서 매칭 비교 | ||
137 | + // 비교 lMatchingDataOne vs mMatchingDataTwo | ||
138 | + List<Map> lMatchingResultUpdate = new ArrayList<Map>(); // 업데이트할 대상 | ||
139 | + | ||
140 | + String mtchSys = "AUTO"; | ||
141 | + String mtchType = "EX_" + iCmbnOwnCnt + "_" + iCmbnTranCnt; | ||
142 | + String mtchTypeName = "자기(" + iCmbnOwnCnt + "건Sum), 상대(" + iCmbnTranCnt + "건Sum), (" + sDelngCrncy + "), 비교(금액)"; | ||
143 | + for (BigDecimal curKey : mMatchingDataOne.keySet()) { | ||
144 | + if (mMatchingDataTwo.containsKey(curKey)) { | ||
145 | + List<List<Map>> llMapOne = mMatchingDataOne.get(curKey); | ||
146 | + List<List<Map>> llMapTwo = mMatchingDataTwo.get(curKey); | ||
147 | + | ||
148 | + // 위와 관련된 동일 레코드가 있는 리스트 삭제 | ||
149 | + for (int i = llMapOne.size() - 1; i >= 0; i--) { | ||
150 | + List<Map> curlMap = llMapOne.get(i); | ||
146 | for (Map curMap : lMatchingResultUpdate) { | 151 | for (Map curMap : lMatchingResultUpdate) { |
147 | int curIdx = curlMap.indexOf(curMap); | 152 | int curIdx = curlMap.indexOf(curMap); |
148 | if (curIdx != -1) { | 153 | if (curIdx != -1) { |
149 | llMapOne.remove(i); | 154 | llMapOne.remove(i); |
150 | break; | 155 | break; |
151 | - } | 156 | + } |
152 | } | 157 | } |
153 | } | 158 | } |
154 | - for (int i=llMapTwo.size()-1; i>=0;i--) { | ||
155 | - List<Map> curlMap = llMapTwo.get(i); | 159 | + for (int i = llMapTwo.size() - 1; i >= 0; i--) { |
160 | + List<Map> curlMap = llMapTwo.get(i); | ||
156 | for (Map curMap : lMatchingResultUpdate) { | 161 | for (Map curMap : lMatchingResultUpdate) { |
157 | int curIdx = curlMap.indexOf(curMap); | 162 | int curIdx = curlMap.indexOf(curMap); |
158 | if (curIdx != -1) { | 163 | if (curIdx != -1) { |
159 | llMapTwo.remove(i); | 164 | llMapTwo.remove(i); |
160 | break; | 165 | break; |
161 | - } | 166 | + } |
162 | } | 167 | } |
163 | } | 168 | } |
164 | - | ||
165 | - | ||
166 | - int iMin = Math.min(llMapOne.size(), llMapTwo.size()); | ||
167 | - if (iMin > 0) mtchNumber++; | ||
168 | - while (iMin > 0) { | ||
169 | - List<Map> curlMapOne = llMapOne.get(0); | ||
170 | - for (Map curMap : curlMapOne) { | ||
171 | - curMap.put("mtch_sys", mtchSys); | ||
172 | - curMap.put("mtch_ty", mtchType); | ||
173 | - curMap.put("mtch_ty_nm", mtchTypeName); | ||
174 | - curMap.put("mtch_ky", mtchNumber); | ||
175 | - lMatchingResultUpdate.add(curMap); | ||
176 | - } | 169 | + |
170 | + int iMin = Math.min(llMapOne.size(), llMapTwo.size()); | ||
171 | + if (iMin > 0) { | ||
172 | + mtchNumber++; | ||
173 | + } | ||
174 | + while (iMin > 0) { | ||
175 | + List<Map> curlMapOne = llMapOne.get(0); | ||
176 | + for (Map curMap : curlMapOne) { | ||
177 | + curMap.put("mtch_sys", mtchSys); | ||
178 | + curMap.put("mtch_ty", mtchType); | ||
179 | + curMap.put("mtch_ty_nm", mtchTypeName); | ||
180 | + curMap.put("mtch_ky", mtchNumber); | ||
181 | + lMatchingResultUpdate.add(curMap); | ||
182 | + } | ||
177 | llMapOne.remove(0); | 183 | llMapOne.remove(0); |
178 | 184 | ||
179 | List<Map> curlMapTwo = llMapTwo.get(0); | 185 | List<Map> curlMapTwo = llMapTwo.get(0); |
180 | - for (Map curMap : curlMapTwo) { | ||
181 | - curMap.put("mtch_sys", mtchSys); | ||
182 | - curMap.put("mtch_ty", mtchType); | ||
183 | - curMap.put("mtch_ty_nm", mtchTypeName); | ||
184 | - curMap.put("mtch_ky", mtchNumber); | ||
185 | - lMatchingResultUpdate.add(curMap); | ||
186 | - } | 186 | + for (Map curMap : curlMapTwo) { |
187 | + curMap.put("mtch_sys", mtchSys); | ||
188 | + curMap.put("mtch_ty", mtchType); | ||
189 | + curMap.put("mtch_ty_nm", mtchTypeName); | ||
190 | + curMap.put("mtch_ky", mtchNumber); | ||
191 | + lMatchingResultUpdate.add(curMap); | ||
192 | + } | ||
187 | llMapTwo.remove(0); | 193 | llMapTwo.remove(0); |
188 | 194 | ||
189 | - //위와 관련된 동일 레코드가 있는 리스트 삭제(추가 업데이트 목록) | ||
190 | - for (int i=llMapOne.size()-1; i>=0;i--) { | ||
191 | - List<Map> curlMap = llMapOne.get(i); | ||
192 | - for (Map curMap : curlMapOne) { | ||
193 | - int curIdx = curlMap.indexOf(curMap); | ||
194 | - if (curIdx != -1) { | ||
195 | - llMapOne.remove(i); | ||
196 | - break; | ||
197 | - } | ||
198 | - } | ||
199 | - } | ||
200 | - for (int i=llMapTwo.size()-1; i>=0;i--) { | ||
201 | - List<Map> curlMap = llMapTwo.get(i); | ||
202 | - for (Map curMap : curlMapTwo) { | ||
203 | - int curIdx = curlMap.indexOf(curMap); | ||
204 | - if (curIdx != -1) { | ||
205 | - llMapTwo.remove(i); | ||
206 | - break; | ||
207 | - } | ||
208 | - } | ||
209 | - } | ||
210 | - iMin = Math.min(llMapOne.size(), llMapTwo.size()); | ||
211 | - } | ||
212 | - } | ||
213 | - } | ||
214 | - | ||
215 | - //---------------------------------------------------------------------------- | ||
216 | - //여기서 결과 업데이트 | ||
217 | - iUpdated = 0; | ||
218 | - int limit = 1000; //1000건씩 batch | ||
219 | - List<Map> lUpdated = new ArrayList<Map>(); | ||
220 | - for (Map curMap : lMatchingResultUpdate) { | ||
221 | - lUpdated.add(curMap); | ||
222 | - if (lUpdated.size() == limit) { | ||
223 | - matchingInnerDelingMapper.setExtraResult(Map.of("itemList", lUpdated)); | ||
224 | - iUpdated = iUpdated + lUpdated.size(); | ||
225 | - lUpdated.clear(); | ||
226 | - } | ||
227 | - } | ||
228 | - if (lUpdated.size() > 0) { | ||
229 | - matchingInnerDelingMapper.setExtraResult(Map.of("itemList", lUpdated)); | ||
230 | - iUpdated = iUpdated + lUpdated.size(); | ||
231 | - } | ||
232 | - log.debug("Updated OrgData : " + iUpdated + "건"); | ||
233 | - | ||
234 | - | ||
235 | - //작업종료에 대한 로그 업데이트 | ||
236 | - paramLog.put("exit_code", "0"); | ||
237 | - paramLog.put("exit_message", ""); | ||
238 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
239 | - | ||
240 | - } | ||
241 | - | 195 | + // 위와 관련된 동일 레코드가 있는 리스트 삭제(추가 업데이트 목록) |
196 | + for (int i = llMapOne.size() - 1; i >= 0; i--) { | ||
197 | + List<Map> curlMap = llMapOne.get(i); | ||
198 | + for (Map curMap : curlMapOne) { | ||
199 | + int curIdx = curlMap.indexOf(curMap); | ||
200 | + if (curIdx != -1) { | ||
201 | + llMapOne.remove(i); | ||
202 | + break; | ||
203 | + } | ||
204 | + } | ||
205 | + } | ||
206 | + for (int i = llMapTwo.size() - 1; i >= 0; i--) { | ||
207 | + List<Map> curlMap = llMapTwo.get(i); | ||
208 | + for (Map curMap : curlMapTwo) { | ||
209 | + int curIdx = curlMap.indexOf(curMap); | ||
210 | + if (curIdx != -1) { | ||
211 | + llMapTwo.remove(i); | ||
212 | + break; | ||
213 | + } | ||
214 | + } | ||
215 | + } | ||
216 | + iMin = Math.min(llMapOne.size(), llMapTwo.size()); | ||
217 | + } | ||
218 | + } | ||
219 | + } | ||
220 | + | ||
221 | + // ---------------------------------------------------------------------------- | ||
222 | + // 여기서 결과 업데이트 | ||
223 | + iUpdated = 0; | ||
224 | + int limit = 1000; // 1000건씩 batch | ||
225 | + List<Map> lUpdated = new ArrayList<Map>(); | ||
226 | + for (Map curMap : lMatchingResultUpdate) { | ||
227 | + lUpdated.add(curMap); | ||
228 | + if (lUpdated.size() == limit) { | ||
229 | + matchingInnerDelingMapper.setExtraResult(Map.of("itemList", lUpdated)); | ||
230 | + iUpdated = iUpdated + lUpdated.size(); | ||
231 | + lUpdated.clear(); | ||
232 | + } | ||
233 | + } | ||
234 | + if (lUpdated.size() > 0) { | ||
235 | + matchingInnerDelingMapper.setExtraResult(Map.of("itemList", lUpdated)); | ||
236 | + iUpdated = iUpdated + lUpdated.size(); | ||
237 | + } | ||
238 | + log.debug("Updated OrgData : " + iUpdated + "건"); | ||
239 | + | ||
240 | + // 작업종료에 대한 로그 업데이트 | ||
241 | + paramLog.put("exit_code", "0"); | ||
242 | + paramLog.put("exit_message", ""); | ||
243 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
244 | + | ||
245 | + return mtchNumber; | ||
246 | + } | ||
247 | + | ||
242 | } | 248 | } |
243 | \ No newline at end of file | 249 | \ No newline at end of file |
src/main/java/com/batch/config/MatchingItemWriter.java
1 | package com.batch.config; | 1 | package com.batch.config; |
2 | 2 | ||
3 | -import java.util.HashMap; | ||
4 | -import java.util.List; | ||
5 | import java.util.Map; | 3 | import java.util.Map; |
6 | 4 | ||
7 | -import org.springframework.batch.core.configuration.annotation.JobScope; | ||
8 | -import org.springframework.batch.item.ItemProcessor; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
10 | -import org.springframework.beans.factory.annotation.Value; | ||
11 | import org.springframework.stereotype.Component; | 6 | import org.springframework.stereotype.Component; |
12 | 7 | ||
13 | import com.batch.mapper.primary.MatchingInnerDelingMapper; | 8 | import com.batch.mapper.primary.MatchingInnerDelingMapper; |
src/main/java/com/batch/config/MatchingSetup.java
src/main/java/com/batch/config/PrimaryMybatisConfiguration.java
@@ -11,7 +11,6 @@ import org.springframework.context.ApplicationContext; | @@ -11,7 +11,6 @@ import org.springframework.context.ApplicationContext; | ||
11 | import org.springframework.context.annotation.Bean; | 11 | import org.springframework.context.annotation.Bean; |
12 | import org.springframework.context.annotation.Configuration; | 12 | import org.springframework.context.annotation.Configuration; |
13 | import org.springframework.context.annotation.Primary; | 13 | import org.springframework.context.annotation.Primary; |
14 | -import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
15 | 14 | ||
16 | @Configuration | 15 | @Configuration |
17 | @MapperScan(value = "com.batch.mapper.primary", sqlSessionFactoryRef="primarySqlSessionFactory") | 16 | @MapperScan(value = "com.batch.mapper.primary", sqlSessionFactoryRef="primarySqlSessionFactory") |
src/main/java/com/batch/config/SecondaryMyBatisConfiguration.java
@@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Qualifier; | @@ -10,7 +10,6 @@ import org.springframework.beans.factory.annotation.Qualifier; | ||
10 | import org.springframework.context.ApplicationContext; | 10 | import org.springframework.context.ApplicationContext; |
11 | import org.springframework.context.annotation.Bean; | 11 | import org.springframework.context.annotation.Bean; |
12 | import org.springframework.context.annotation.Configuration; | 12 | import org.springframework.context.annotation.Configuration; |
13 | -import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
14 | 13 | ||
15 | @Configuration | 14 | @Configuration |
16 | @MapperScan(value = "com.batch.mapper.secondary", sqlSessionFactoryRef="secondarySqlSessionFactory") | 15 | @MapperScan(value = "com.batch.mapper.secondary", sqlSessionFactoryRef="secondarySqlSessionFactory") |
src/main/java/com/batch/controller/JobController.java
@@ -7,8 +7,6 @@ import java.util.Map; | @@ -7,8 +7,6 @@ import java.util.Map; | ||
7 | import java.util.UUID; | 7 | import java.util.UUID; |
8 | 8 | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
10 | -import org.springframework.transaction.annotation.Isolation; | ||
11 | -import org.springframework.transaction.annotation.Transactional; | ||
12 | import org.springframework.web.bind.annotation.GetMapping; | 10 | import org.springframework.web.bind.annotation.GetMapping; |
13 | import org.springframework.web.bind.annotation.PathVariable; | 11 | import org.springframework.web.bind.annotation.PathVariable; |
14 | import org.springframework.web.bind.annotation.PostMapping; | 12 | import org.springframework.web.bind.annotation.PostMapping; |
@@ -19,7 +17,6 @@ import org.springframework.web.bind.annotation.RestController; | @@ -19,7 +17,6 @@ import org.springframework.web.bind.annotation.RestController; | ||
19 | import com.batch.config.MatchingSetup; | 17 | import com.batch.config.MatchingSetup; |
20 | import com.batch.config.MatchingSetup.Matching; | 18 | import com.batch.config.MatchingSetup.Matching; |
21 | import com.batch.mapper.primary.MatchingInnerDelingMapper; | 19 | import com.batch.mapper.primary.MatchingInnerDelingMapper; |
22 | -import com.batch.mapper.secondary.OracleMapper; | ||
23 | import com.batch.service.JobService; | 20 | import com.batch.service.JobService; |
24 | import com.batch.util.FileUtil; | 21 | import com.batch.util.FileUtil; |
25 | import com.google.gson.JsonObject; | 22 | import com.google.gson.JsonObject; |
@@ -43,6 +40,17 @@ public class JobController { | @@ -43,6 +40,17 @@ public class JobController { | ||
43 | /** | 40 | /** |
44 | * TODO : AI 서버에 특정 경로에 생성되는 파일을 읽는(끝에 50줄 정도) API | 41 | * TODO : AI 서버에 특정 경로에 생성되는 파일을 읽는(끝에 50줄 정도) API |
45 | * */ | 42 | * */ |
43 | + @PostMapping("/readlogs") | ||
44 | + public StringBuffer readLogs( @RequestBody Map<String, String> params) throws Exception { | ||
45 | + StringBuffer sb = new StringBuffer(); | ||
46 | + | ||
47 | + String filePath = params.get("filePath"); | ||
48 | + int readCnt = Integer.parseInt(params.get("readCnt")); | ||
49 | + | ||
50 | + sb = FileUtil.readFileLastLines(filePath, readCnt); | ||
51 | + | ||
52 | + return sb; | ||
53 | + } | ||
46 | 54 | ||
47 | @PostMapping("/create") | 55 | @PostMapping("/create") |
48 | public Map<String, String> createJob( @RequestBody Map<String, String> params) throws Exception { | 56 | public Map<String, String> createJob( @RequestBody Map<String, String> params) throws Exception { |
@@ -146,11 +154,9 @@ public class JobController { | @@ -146,11 +154,9 @@ public class JobController { | ||
146 | 154 | ||
147 | /** extraJobSub2 start ************************************************************************************** */ | 155 | /** extraJobSub2 start ************************************************************************************** */ |
148 | long startTime = System.currentTimeMillis(); | 156 | long startTime = System.currentTimeMillis(); |
149 | - log.info("### Start Extra Matching Job : "+startTime); | 157 | + log.info("### Start Extra Matching Job2 : "+startTime); |
150 | jobService.extraJobSub2(sJobGroup, params); | 158 | jobService.extraJobSub2(sJobGroup, params); |
151 | 159 | ||
152 | - long endTime = System.currentTimeMillis(); | ||
153 | - log.info("### End Extra Matching Job : "+endTime); | ||
154 | /** extraJobSub2 end ************************************************************************************** */ | 160 | /** extraJobSub2 end ************************************************************************************** */ |
155 | 161 | ||
156 | 162 |
src/main/java/com/batch/mapper/primary/MatchingInnerDelingMapper.java
@@ -169,4 +169,27 @@ public interface MatchingInnerDelingMapper { | @@ -169,4 +169,27 @@ public interface MatchingInnerDelingMapper { | ||
169 | @SuppressWarnings("rawtypes") | 169 | @SuppressWarnings("rawtypes") |
170 | List<Map> getUserJobStatus(Map param); | 170 | List<Map> getUserJobStatus(Map param); |
171 | 171 | ||
172 | + | ||
173 | + | ||
174 | + | ||
175 | + | ||
176 | + | ||
177 | + /** | ||
178 | + * 매칭제외1 : 거래금액 = 0 | ||
179 | + * @param param | ||
180 | + * @return | ||
181 | + */ | ||
182 | + @SuppressWarnings("rawtypes") | ||
183 | + int updateInitExclusion1(Map param); | ||
184 | + | ||
185 | + | ||
186 | + /** | ||
187 | + * 매칭제외2 : 거래유형, 자기/상대 법인, 거래일자, 계정 이 같은 1:1 내역 금액이 +, - 로 합이 0 인 경우 | ||
188 | + * @param param | ||
189 | + * @return | ||
190 | + */ | ||
191 | + @SuppressWarnings("rawtypes") | ||
192 | + int updateInitExclusion2(Map param); | ||
193 | + | ||
194 | + | ||
172 | } | 195 | } |
173 | \ No newline at end of file | 196 | \ No newline at end of file |
src/main/java/com/batch/service/JobService.java
@@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Value; | @@ -24,8 +24,6 @@ import org.springframework.beans.factory.annotation.Value; | ||
24 | import org.springframework.context.ApplicationContext; | 24 | import org.springframework.context.ApplicationContext; |
25 | import org.springframework.scheduling.annotation.Async; | 25 | import org.springframework.scheduling.annotation.Async; |
26 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
27 | -import org.springframework.transaction.annotation.Isolation; | ||
28 | -import org.springframework.transaction.annotation.Transactional; | ||
29 | import org.zeroturnaround.exec.ProcessExecutor; | 27 | import org.zeroturnaround.exec.ProcessExecutor; |
30 | import org.zeroturnaround.exec.stream.LogOutputStream; | 28 | import org.zeroturnaround.exec.stream.LogOutputStream; |
31 | 29 | ||
@@ -48,455 +46,458 @@ public class JobService { | @@ -48,455 +46,458 @@ public class JobService { | ||
48 | 46 | ||
49 | @Value("${python.ai.target}") | 47 | @Value("${python.ai.target}") |
50 | String sPythonAiTarget; | 48 | String sPythonAiTarget; |
51 | - | ||
52 | - @Autowired | ||
53 | - private JobLauncher jobLauncher; | ||
54 | 49 | ||
55 | - @Autowired | ||
56 | - private ApplicationContext context; | 50 | + @Autowired |
51 | + private JobLauncher jobLauncher; | ||
57 | 52 | ||
58 | - @Autowired | ||
59 | - private MatchingInnerDelingMapper matchingInnerDelingMapper; | 53 | + @Autowired |
54 | + private ApplicationContext context; | ||
60 | 55 | ||
61 | - @Autowired | ||
62 | - private OracleMapper oracleMapper; | ||
63 | - | ||
64 | - | ||
65 | - @SuppressWarnings("rawtypes") | 56 | + @Autowired |
57 | + private MatchingInnerDelingMapper matchingInnerDelingMapper; | ||
58 | + | ||
59 | + @Autowired | ||
60 | + private OracleMapper oracleMapper; | ||
61 | + | ||
62 | + @SuppressWarnings("rawtypes") | ||
66 | @Async("commAsync") | 63 | @Async("commAsync") |
67 | - public void matchingJob(String jobGroupId, Map<String, String> params) throws Exception { | ||
68 | - | ||
69 | - //Job Create Log | ||
70 | - UUID uuid = UUID.randomUUID(); | ||
71 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
72 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
73 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
74 | - | ||
75 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
76 | - paramLog.put("user_job_group", jobGroupId); | ||
77 | - paramLog.put("user_job_id", sDate); | ||
78 | - paramLog.put("user_job_name", "자동매칭(" + params.toString() + ")"); | ||
79 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
80 | - | ||
81 | - String sThreadName = Thread.currentThread().getName(); | ||
82 | - long startTime = System.currentTimeMillis(); | ||
83 | - log.info("[" + sThreadName + "]Job Started : " + startTime); | ||
84 | - log.debug("[" + sThreadName + "]params=" + params.toString()); | ||
85 | - | ||
86 | - StringBuffer sb = FileUtil.readFileToString("matchingSetup.json"); | ||
87 | - MatchingSetup matchingSetup = (MatchingSetup) FileUtil.strToObj(sb.toString(), MatchingSetup.class); | ||
88 | - | ||
89 | - String sJobTypeList = params.get("jobType").toUpperCase(); | ||
90 | - List<String> lJobType = Arrays.asList(sJobTypeList != null?sJobTypeList.split(","):new String[0]); | ||
91 | - | ||
92 | - //파라미터가 ALL일 경우 ALL 대신 등록된 모든 Type를 넣어준다. | ||
93 | - if (lJobType.size() > 0 && lJobType.indexOf("ALL") != -1) { | ||
94 | - lJobType = new ArrayList(); | ||
95 | - for (Matching matching : matchingSetup.getMatchingSetup()) { | ||
96 | - if (matching.getActive()) { | ||
97 | - lJobType.add(matching.getType()); | ||
98 | - } else { | ||
99 | - log.info("[" + sThreadName + "]JobType(" + matching.getType() + ") is Disabled"); | ||
100 | - } | ||
101 | - } | ||
102 | - } | ||
103 | - | ||
104 | - | ||
105 | - for (String sJobType : lJobType) { | ||
106 | - log.info("[" + sThreadName + "]Current running job type: " + sJobType); | ||
107 | - JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params); | ||
108 | - if (!jobExe.getStatus().equals(BatchStatus.COMPLETED)) { | ||
109 | - throw new Exception("Job execution error : Batchstatus(" + jobExe.getStatus() + "), ExitStatus(" + jobExe.getExitStatus() + ")" ); | ||
110 | - } | ||
111 | - } | ||
112 | - | ||
113 | - long endTime = System.currentTimeMillis(); | ||
114 | - log.info("[" + sThreadName + "]Job Type : " + lJobType.toString()); | ||
115 | - log.info("[" + sThreadName + "]Job Ended: " + endTime); | ||
116 | - log.info("[" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
117 | - | ||
118 | - //작업종료에 대한 로그 업데이트 | ||
119 | - paramLog.put("exit_code", "0"); | ||
120 | - paramLog.put("exit_message", ""); | ||
121 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
122 | - | ||
123 | - } | ||
124 | - | ||
125 | - | ||
126 | - | ||
127 | - | ||
128 | - | ||
129 | - @SuppressWarnings("rawtypes") | 64 | + public void matchingJob(String jobGroupId, Map<String, String> params) throws Exception { |
65 | + | ||
66 | + // Job Create Log | ||
67 | + UUID uuid = UUID.randomUUID(); | ||
68 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
69 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
70 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
71 | + | ||
72 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
73 | + paramLog.put("user_job_group", jobGroupId); | ||
74 | + paramLog.put("user_job_id", sDate); | ||
75 | + paramLog.put("user_job_name", "자동매칭(" + params.toString() + ")"); | ||
76 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
77 | + | ||
78 | + String sThreadName = Thread.currentThread().getName(); | ||
79 | + long startTime = System.currentTimeMillis(); | ||
80 | + log.info("[" + sThreadName + "]Job Started : " + startTime); | ||
81 | + log.debug("[" + sThreadName + "]params=" + params.toString()); | ||
82 | + | ||
83 | + StringBuffer sb = FileUtil.readFileToString("matchingSetup.json"); | ||
84 | + MatchingSetup matchingSetup = (MatchingSetup) FileUtil.strToObj(sb.toString(), MatchingSetup.class); | ||
85 | + | ||
86 | + String sJobTypeList = params.get("jobType").toUpperCase(); | ||
87 | + List<String> lJobType = Arrays.asList(sJobTypeList != null ? sJobTypeList.split(",") : new String[0]); | ||
88 | + | ||
89 | + // 파라미터가 ALL일 경우 ALL 대신 등록된 모든 Type를 넣어준다. | ||
90 | + if (lJobType.size() > 0 && lJobType.indexOf("ALL") != -1) { | ||
91 | + lJobType = new ArrayList(); | ||
92 | + for (Matching matching : matchingSetup.getMatchingSetup()) { | ||
93 | + if (matching.getActive()) { | ||
94 | + lJobType.add(matching.getType()); | ||
95 | + } else { | ||
96 | + log.info("[" + sThreadName + "]JobType(" + matching.getType() + ") is Disabled"); | ||
97 | + } | ||
98 | + } | ||
99 | + } | ||
100 | + | ||
101 | + for (String sJobType : lJobType) { | ||
102 | + log.info("[" + sThreadName + "]Current running job type: " + sJobType); | ||
103 | + JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params); | ||
104 | + if (!jobExe.getStatus().equals(BatchStatus.COMPLETED)) { | ||
105 | + throw new Exception("Job execution error : Batchstatus(" + jobExe.getStatus() + "), ExitStatus(" + jobExe.getExitStatus() + ")"); | ||
106 | + } | ||
107 | + } | ||
108 | + | ||
109 | + long endTime = System.currentTimeMillis(); | ||
110 | + log.info("[" + sThreadName + "]Job Type : " + lJobType.toString()); | ||
111 | + log.info("[" + sThreadName + "]Job Ended: " + endTime); | ||
112 | + log.info("[" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
113 | + | ||
114 | + // 작업종료에 대한 로그 업데이트 | ||
115 | + paramLog.put("exit_code", "0"); | ||
116 | + paramLog.put("exit_message", ""); | ||
117 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
118 | + | ||
119 | + } | ||
120 | + | ||
121 | + @SuppressWarnings("rawtypes") | ||
130 | @Async("extAsync") | 122 | @Async("extAsync") |
131 | - public void extraJobSub(String jobGroupId, Map paramRec, int key) throws Exception { | ||
132 | - | ||
133 | - int mtchNumber = key; | ||
134 | - //Job Create Log | ||
135 | - UUID uuid = UUID.randomUUID(); | ||
136 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
137 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
138 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
139 | - | ||
140 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
141 | - paramLog.put("user_job_group", jobGroupId); | ||
142 | - paramLog.put("user_job_id", sDate); | ||
143 | - paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
144 | - | ||
145 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
146 | - | ||
147 | - String sThreadName = Thread.currentThread().getName(); | ||
148 | - long startTime = System.currentTimeMillis(); | ||
149 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString()); | ||
150 | - log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
151 | - | ||
152 | - MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper); | ||
153 | - | ||
154 | - //2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
155 | - for (int i=0; i<20000;i=i+1000) { | ||
156 | - matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
157 | - } | ||
158 | - for (int i=0; i<20000;i=i+1000) { | ||
159 | - matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
160 | - } | ||
161 | - for (int i=0; i<20000;i=i+1000) { | ||
162 | - matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
163 | - } | ||
164 | - | ||
165 | - //3건씩 매칭일 경우 최대 5000건 까지 | ||
166 | - for (int i=0; i<2000;i=i+100) { | ||
167 | - matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
168 | - } | ||
169 | - for (int i=0; i<2000;i=i+100) { | ||
170 | - matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
171 | - } | ||
172 | - | ||
173 | - long endTime = System.currentTimeMillis(); | ||
174 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime); | ||
175 | - log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
176 | - | ||
177 | - //작업종료에 대한 로그 업데이트 | ||
178 | - paramLog.put("exit_code", "0"); | ||
179 | - paramLog.put("exit_message", ""); | ||
180 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
181 | - | ||
182 | - } | ||
183 | - | ||
184 | - | ||
185 | - @SuppressWarnings("rawtypes") | 123 | + public void extraJobSub(String jobGroupId, Map paramRec, int key) throws Exception { |
124 | + | ||
125 | + int mtchNumber = key; | ||
126 | + // Job Create Log | ||
127 | + UUID uuid = UUID.randomUUID(); | ||
128 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
129 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
130 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
131 | + | ||
132 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
133 | + paramLog.put("user_job_group", jobGroupId); | ||
134 | + paramLog.put("user_job_id", sDate); | ||
135 | + paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
136 | + | ||
137 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
138 | + | ||
139 | + String sThreadName = Thread.currentThread().getName(); | ||
140 | + long startTime = System.currentTimeMillis(); | ||
141 | + log.info("extra [" + sThreadName + " : " + sDate + "]Job Started : " + startTime + "]params=" + paramRec.toString()); | ||
142 | + log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
143 | + | ||
144 | + MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper); | ||
145 | + | ||
146 | + // 2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
147 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
148 | + matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
149 | + } | ||
150 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
151 | + matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
152 | + } | ||
153 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
154 | + matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
155 | + } | ||
156 | + | ||
157 | + // 3건씩 매칭일 경우 최대 5000건 까지 | ||
158 | + for (int i = 0; i < 2000; i = i + 100) { | ||
159 | + matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
160 | + } | ||
161 | + for (int i = 0; i < 2000; i = i + 100) { | ||
162 | + matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
163 | + } | ||
164 | + | ||
165 | + long endTime = System.currentTimeMillis(); | ||
166 | + log.info("extra [" + sThreadName + " : " + sDate + "]Job Ended: " + endTime); | ||
167 | + log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
168 | + | ||
169 | + // 작업종료에 대한 로그 업데이트 | ||
170 | + paramLog.put("exit_code", "0"); | ||
171 | + paramLog.put("exit_message", ""); | ||
172 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
173 | + | ||
174 | + } | ||
175 | + | ||
176 | + @SuppressWarnings("rawtypes") | ||
186 | @Async("extAsync") | 177 | @Async("extAsync") |
187 | - public void extraJobSub2(String jobGroupId, Map paramRec) throws Exception { | ||
188 | - | ||
189 | - | ||
190 | - List<Map> retData = matchingInnerDelingMapper.getCustomItemReadData(paramRec); | ||
191 | - | ||
192 | - int mtchNumber = 0; | ||
193 | - paramRec.put("conds", "T"); | ||
194 | - for(Map curMap : retData) { | ||
195 | - paramRec.putAll(curMap); | ||
196 | - //Job Create Log | ||
197 | - UUID uuid = UUID.randomUUID(); | ||
198 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
199 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
200 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
201 | - | ||
202 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
203 | - paramLog.put("user_job_group", jobGroupId); | ||
204 | - paramLog.put("user_job_id", sDate); | ||
205 | - paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
206 | - try { | ||
207 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
208 | - }catch(Exception e) { | ||
209 | - log.info("createUserJob Exception : "+e.getMessage()); | ||
210 | - } | ||
211 | - String sThreadName = Thread.currentThread().getName(); | ||
212 | - long startTime = System.currentTimeMillis(); | ||
213 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString()); | ||
214 | - log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
215 | - | ||
216 | - MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper); | ||
217 | - | ||
218 | - //2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
219 | - for (int i=0; i<20000;i=i+1000) { | ||
220 | - matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
221 | - } | ||
222 | - for (int i=0; i<20000;i=i+1000) { | ||
223 | - matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
224 | - } | ||
225 | - for (int i=0; i<20000;i=i+1000) { | ||
226 | - matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
227 | - } | ||
228 | - | ||
229 | - //3건씩 매칭일 경우 최대 5000건 까지 | ||
230 | - for (int i=0; i<2000;i=i+100) { | ||
231 | - matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
232 | - } | ||
233 | - for (int i=0; i<2000;i=i+100) { | ||
234 | - matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
235 | - } | ||
236 | - | ||
237 | - long endTime = System.currentTimeMillis(); | ||
238 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime); | ||
239 | - log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
240 | - | ||
241 | - //작업종료에 대한 로그 업데이트 | ||
242 | - paramLog.put("exit_code", "0"); | ||
243 | - paramLog.put("exit_message", ""); | ||
244 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
245 | - | ||
246 | - } | ||
247 | - | ||
248 | - | ||
249 | - paramRec.put("conds", "B"); | ||
250 | - for(Map curMap : retData) { | ||
251 | - paramRec.putAll(curMap); | ||
252 | - | ||
253 | - //Job Create Log | ||
254 | - UUID uuid = UUID.randomUUID(); | ||
255 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
256 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
257 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
258 | - | ||
259 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
260 | - paramLog.put("user_job_group", jobGroupId); | ||
261 | - paramLog.put("user_job_id", sDate); | ||
262 | - paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
263 | - try { | ||
264 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
265 | - }catch(Exception e) { | ||
266 | - log.info("createUserJob Exception : "+e.getMessage()); | ||
267 | - } | ||
268 | - String sThreadName = Thread.currentThread().getName(); | ||
269 | - long startTime = System.currentTimeMillis(); | ||
270 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString()); | ||
271 | - log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
272 | - | ||
273 | - MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper); | ||
274 | - | ||
275 | - //2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
276 | - for (int i=0; i<20000;i=i+1000) { | ||
277 | - matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
278 | - } | ||
279 | - for (int i=0; i<20000;i=i+1000) { | ||
280 | - matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
281 | - } | ||
282 | - for (int i=0; i<20000;i=i+1000) { | ||
283 | - matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
284 | - } | ||
285 | - | ||
286 | - //3건씩 매칭일 경우 최대 5000건 까지 | ||
287 | - for (int i=0; i<2000;i=i+100) { | ||
288 | - matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
289 | - } | ||
290 | - for (int i=0; i<2000;i=i+100) { | ||
291 | - matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
292 | - } | ||
293 | - | ||
294 | - long endTime = System.currentTimeMillis(); | ||
295 | - log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime); | ||
296 | - log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
297 | - | ||
298 | - //작업종료에 대한 로그 업데이트 | ||
299 | - paramLog.put("exit_code", "0"); | ||
300 | - paramLog.put("exit_message", ""); | ||
301 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
302 | - | ||
303 | - } | ||
304 | - | ||
305 | - } | ||
306 | - | ||
307 | - @SuppressWarnings("rawtypes") | 178 | + public void extraJobSub2(String jobGroupId, Map paramRec) throws Exception { |
179 | + | ||
180 | + List<Map> retData = matchingInnerDelingMapper.getCustomItemReadData(paramRec); | ||
181 | + | ||
182 | + long mtchNumber = 10000; | ||
183 | + paramRec.put("conds", "T"); | ||
184 | + for (Map curMap : retData) { | ||
185 | + paramRec.putAll(curMap); | ||
186 | + // Job Create Log | ||
187 | + UUID uuid = UUID.randomUUID(); | ||
188 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
189 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
190 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
191 | + | ||
192 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
193 | + paramLog.put("user_job_group", jobGroupId); | ||
194 | + paramLog.put("user_job_id", sDate); | ||
195 | + paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
196 | + try { | ||
197 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
198 | + } catch (Exception e) { | ||
199 | + log.info("createUserJob Exception : " + e.getMessage()); | ||
200 | + } | ||
201 | + String sThreadName = Thread.currentThread().getName(); | ||
202 | + long startTime = System.currentTimeMillis(); | ||
203 | + log.info("extra [" + sThreadName + " : " + sDate + "]Job Started : " + startTime + "]params=" + paramRec.toString()); | ||
204 | + log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
205 | + | ||
206 | + MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper); | ||
207 | + | ||
208 | + // 2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
209 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
210 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
211 | + } | ||
212 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
213 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
214 | + } | ||
215 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
216 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
217 | + } | ||
218 | + | ||
219 | + // 3건씩 매칭일 경우 최대 5000건 까지 | ||
220 | + for (int i = 0; i < 2000; i = i + 100) { | ||
221 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
222 | + } | ||
223 | + for (int i = 0; i < 2000; i = i + 100) { | ||
224 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
225 | + } | ||
226 | + | ||
227 | + long endTime = System.currentTimeMillis(); | ||
228 | + log.info( | ||
229 | + "extra [" + sThreadName + " : " + sDate + "]Job Ended: " + endTime + " mtchNumber = " + mtchNumber); | ||
230 | + log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
231 | + | ||
232 | + // 작업종료에 대한 로그 업데이트 | ||
233 | + paramLog.put("exit_code", "0"); | ||
234 | + paramLog.put("exit_message", ""); | ||
235 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
236 | + | ||
237 | + } | ||
238 | + | ||
239 | + paramRec.put("conds", "B"); | ||
240 | + for (Map curMap : retData) { | ||
241 | + paramRec.putAll(curMap); | ||
242 | + | ||
243 | + // Job Create Log | ||
244 | + UUID uuid = UUID.randomUUID(); | ||
245 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
246 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
247 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
248 | + | ||
249 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
250 | + paramLog.put("user_job_group", jobGroupId); | ||
251 | + paramLog.put("user_job_id", sDate); | ||
252 | + paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")"); | ||
253 | + try { | ||
254 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
255 | + } catch (Exception e) { | ||
256 | + log.info("createUserJob Exception : " + e.getMessage()); | ||
257 | + } | ||
258 | + String sThreadName = Thread.currentThread().getName(); | ||
259 | + long startTime = System.currentTimeMillis(); | ||
260 | + log.info("extra [" + sThreadName + " : " + sDate + "]Job Started : " + startTime + "]params=" | ||
261 | + + paramRec.toString()); | ||
262 | + log.debug("extra [" + sThreadName + "]params=" + paramRec.toString()); | ||
263 | + | ||
264 | + MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto( | ||
265 | + matchingInnerDelingMapper); | ||
266 | + | ||
267 | + // 2건씩 합산 매칭일 경우 최대 20000건 까지 | ||
268 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
269 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber); | ||
270 | + } | ||
271 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
272 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber); | ||
273 | + } | ||
274 | + for (int i = 0; i < 20000; i = i + 1000) { | ||
275 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); | ||
276 | + } | ||
277 | + | ||
278 | + // 3건씩 매칭일 경우 최대 5000건 까지 | ||
279 | + for (int i = 0; i < 2000; i = i + 100) { | ||
280 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); | ||
281 | + } | ||
282 | + for (int i = 0; i < 2000; i = i + 100) { | ||
283 | + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); | ||
284 | + } | ||
285 | + | ||
286 | + long endTime = System.currentTimeMillis(); | ||
287 | + log.info("extra [" + sThreadName + " : " + sDate + "]Job Ended: " + endTime + " mtchNumber = " + mtchNumber); | ||
288 | + log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms"); | ||
289 | + | ||
290 | + // 작업종료에 대한 로그 업데이트 | ||
291 | + paramLog.put("exit_code", "0"); | ||
292 | + paramLog.put("exit_message", ""); | ||
293 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
294 | + | ||
295 | + } | ||
296 | + | ||
297 | + long endTime = System.currentTimeMillis(); | ||
298 | + log.info("### End Extra Matching Job2 : " + endTime); | ||
299 | + | ||
300 | + } | ||
301 | + | ||
302 | + @SuppressWarnings("rawtypes") | ||
308 | @Async("aiAsync") | 303 | @Async("aiAsync") |
309 | - public void aiJobSub(String jobGroupId, Map paramRec) throws Exception { | ||
310 | - | ||
311 | - | ||
312 | - //Job Create Log | ||
313 | - UUID uuid = UUID.randomUUID(); | ||
314 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
315 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
316 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
317 | - | ||
318 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
319 | - paramLog.put("user_job_group", jobGroupId); | ||
320 | - paramLog.put("user_job_id", sDate); | ||
321 | - paramLog.put("user_job_name", "AI매칭(" + paramRec.toString() + ")"); | ||
322 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
323 | - | ||
324 | - | ||
325 | - long startTime = System.currentTimeMillis(); | ||
326 | - log.info("ai Job Started : " + startTime); | ||
327 | - log.debug("ai Job params=" + paramRec.toString()); | ||
328 | - | ||
329 | - String sSysSe = (String) paramRec.get("sys_se"); | ||
330 | - String sAccnutYm = (String) paramRec.get("accnut_ym"); | ||
331 | - String sCprCode = (String) paramRec.get("cpr_code"); | ||
332 | - String sPartCpr = (String) paramRec.get("partn_cpr"); | ||
333 | - String sDelngCrncy = (String) paramRec.get("delng_crncy"); | ||
334 | - | ||
335 | - String sThreadName = Thread.currentThread().getName(); | ||
336 | - | ||
337 | - log.debug("call python"); | ||
338 | - new ProcessExecutor() | ||
339 | - .command(sPythonPrg, sPythonAiTarget, sDate, sSysSe, sAccnutYm, sCprCode, sPartCpr, sDelngCrncy) | ||
340 | - .redirectOutput(new LogOutputStream() { | ||
341 | - @Override | ||
342 | - protected void processLine(String line) { | ||
343 | - log.info(line); | ||
344 | - } | ||
345 | - }) | ||
346 | - .execute(); | ||
347 | - | ||
348 | - long endTime = System.currentTimeMillis(); | ||
349 | - log.info("ai Job Ended: " + endTime); | ||
350 | - log.info("ai Job Running Time : " + (endTime - startTime) + "ms"); | ||
351 | - | ||
352 | - | 304 | + public void aiJobSub(String jobGroupId, Map paramRec) throws Exception { |
305 | + | ||
306 | + // Job Create Log | ||
307 | + UUID uuid = UUID.randomUUID(); | ||
308 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
309 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
310 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
311 | + | ||
312 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
313 | + paramLog.put("user_job_group", jobGroupId); | ||
314 | + paramLog.put("user_job_id", sDate); | ||
315 | + paramLog.put("user_job_name", "AI매칭(" + paramRec.toString() + ")"); | ||
316 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
317 | + | ||
318 | + long startTime = System.currentTimeMillis(); | ||
319 | + log.info("ai Job Started : " + startTime); | ||
320 | + log.debug("ai Job params=" + paramRec.toString()); | ||
321 | + | ||
322 | + String sSysSe = (String) paramRec.get("sys_se"); | ||
323 | + String sAccnutYm = (String) paramRec.get("accnut_ym"); | ||
324 | + String sCprCode = (String) paramRec.get("cpr_code"); | ||
325 | + String sPartCpr = (String) paramRec.get("partn_cpr"); | ||
326 | + String sDelngCrncy = (String) paramRec.get("delng_crncy"); | ||
327 | + | ||
328 | + String sThreadName = Thread.currentThread().getName(); | ||
329 | + | ||
330 | + log.debug("call python"); | ||
331 | + new ProcessExecutor() | ||
332 | + .command(sPythonPrg, sPythonAiTarget, sDate, sSysSe, sAccnutYm, sCprCode, sPartCpr, sDelngCrncy) | ||
333 | + .redirectOutput(new LogOutputStream() { | ||
334 | + @Override | ||
335 | + protected void processLine(String line) { | ||
336 | + log.info(line); | ||
337 | + } | ||
338 | + }).execute(); | ||
339 | + | ||
340 | + long endTime = System.currentTimeMillis(); | ||
341 | + log.info("ai Job Ended: " + endTime); | ||
342 | + log.info("ai Job Running Time : " + (endTime - startTime) + "ms"); | ||
343 | + | ||
353 | // //작업종료에 대한 로그 업데이트 | 344 | // //작업종료에 대한 로그 업데이트 |
354 | // paramLog.put("exit_code", "0"); | 345 | // paramLog.put("exit_code", "0"); |
355 | // paramLog.put("exit_message", ""); | 346 | // paramLog.put("exit_message", ""); |
356 | // matchingInnerDelingMapper.finishUserJob(paramLog); | 347 | // matchingInnerDelingMapper.finishUserJob(paramLog); |
357 | - | ||
358 | - } | ||
359 | - | ||
360 | - | ||
361 | - public JobExecution invokeJob(String jobName, String jobType, Map<String, String> params) throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException { | ||
362 | - | ||
363 | - UUID uuid = UUID.randomUUID(); | ||
364 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
365 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
366 | - final String date = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
367 | - JobParameters jobParameters = new JobParametersBuilder() | ||
368 | - .addString("syncDate", date) | ||
369 | - .addString("jobType", jobType) | ||
370 | - .addString("sysSe", params.get("sysSe")) | ||
371 | - .addString("accnutYm", params.get("accnutYm")) | ||
372 | - .addString("searchCond", params.get("searchCond")) | ||
373 | - .toJobParameters(); | ||
374 | - | ||
375 | - var jobToStart = context.getBean(jobName, Job.class); | ||
376 | - JobExecution jobExe = jobLauncher.run(jobToStart, jobParameters); | ||
377 | - | ||
378 | - return jobExe; | ||
379 | - } | ||
380 | - | ||
381 | - | ||
382 | - | ||
383 | - @SuppressWarnings("rawtypes") | 348 | + |
349 | + } | ||
350 | + | ||
351 | + public JobExecution invokeJob(String jobName, String jobType, Map<String, String> params) | ||
352 | + throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, | ||
353 | + JobParametersInvalidException, JobRestartException { | ||
354 | + | ||
355 | + UUID uuid = UUID.randomUUID(); | ||
356 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
357 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
358 | + final String date = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
359 | + JobParameters jobParameters = new JobParametersBuilder().addString("syncDate", date) | ||
360 | + .addString("jobType", jobType).addString("sysSe", params.get("sysSe")) | ||
361 | + .addString("accnutYm", params.get("accnutYm")).addString("searchCond", params.get("searchCond")) | ||
362 | + .toJobParameters(); | ||
363 | + | ||
364 | + var jobToStart = context.getBean(jobName, Job.class); | ||
365 | + JobExecution jobExe = jobLauncher.run(jobToStart, jobParameters); | ||
366 | + | ||
367 | + return jobExe; | ||
368 | + } | ||
369 | + | ||
370 | + @SuppressWarnings("rawtypes") | ||
384 | @Async("commAsync") | 371 | @Async("commAsync") |
385 | - public void createData(String jobGroupId, Map<String, String> params) throws Exception { | ||
386 | - | ||
387 | - //Job Create Log | ||
388 | - UUID uuid = UUID.randomUUID(); | ||
389 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
390 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
391 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
392 | - | ||
393 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
394 | - paramLog.put("user_job_group", jobGroupId); | ||
395 | - paramLog.put("user_job_id", sDate); | ||
396 | - paramLog.put("user_job_name", "작업데이타생성(" + params.toString() + ")"); | ||
397 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
398 | - | ||
399 | - | ||
400 | - long startTime = System.currentTimeMillis(); | ||
401 | - log.info("Create Data Started : " + startTime); | ||
402 | - log.debug("params=" + params.toString()); | ||
403 | - | ||
404 | - //기존데이타 삭제 | 372 | + public void createData(String jobGroupId, Map<String, String> params) throws Exception { |
373 | + | ||
374 | + // Job Create Log | ||
375 | + UUID uuid = UUID.randomUUID(); | ||
376 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
377 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
378 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
379 | + | ||
380 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
381 | + paramLog.put("user_job_group", jobGroupId); | ||
382 | + paramLog.put("user_job_id", sDate); | ||
383 | + paramLog.put("user_job_name", "작업데이타생성(" + params.toString() + ")"); | ||
384 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
385 | + | ||
386 | + long startTime = System.currentTimeMillis(); | ||
387 | + log.info("Create Data Started : " + startTime); | ||
388 | + log.debug("params=" + params.toString()); | ||
389 | + | ||
390 | + // 기존데이타 삭제 | ||
405 | int iDeleted = matchingInnerDelingMapper.deleteOriginalData(params); | 391 | int iDeleted = matchingInnerDelingMapper.deleteOriginalData(params); |
406 | - log.debug("Deleted OrgData : " + iDeleted + "건"); | ||
407 | - | ||
408 | - //신규데이타 생성 | ||
409 | - //매칭키에 대한 정보 (sql로 조인하여 조회하기에는 너무 느리고 데이타 중복도 발생함) | ||
410 | - List<Map> lMatchingInfo = oracleMapper.getMatchingInfo(params); | ||
411 | - Map<String, Map> mMatchingInfo = new HashMap<String, Map>(); | ||
412 | - for (Map curMap : lMatchingInfo) { | ||
413 | - String sKey = String.valueOf(curMap.get("SEQ")); | ||
414 | - mMatchingInfo.put(sKey, curMap); | ||
415 | - } | ||
416 | - | ||
417 | - List<Map> lOrgData = oracleMapper.getOriginalData(params); | ||
418 | - int iInserted = 0; | ||
419 | - int limit = 1000; //1000건씩 batch | ||
420 | - List<Map> lInserted = new ArrayList<Map>(); | ||
421 | - for (Map curRec : lOrgData) { | ||
422 | - String sKey = String.valueOf(curRec.get("SEQ")); | ||
423 | - Map curMatchingInfo = mMatchingInfo.get(sKey); | ||
424 | - if (curMatchingInfo != null) { | ||
425 | - curRec.put("MATCHING_CAUSE", curMatchingInfo.get("MATCHING_CAUSE")); | ||
426 | - curRec.put("MATCH_KEY", curMatchingInfo.get("MATCH_KEY")); | ||
427 | - } | ||
428 | - lInserted.add(curRec); | ||
429 | - if (lInserted.size() == limit) { | ||
430 | - matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted)); | ||
431 | - iInserted = iInserted + lInserted.size(); | ||
432 | - lInserted.clear(); | ||
433 | - } | ||
434 | - } | ||
435 | - if (lInserted.size() > 0) { | ||
436 | - matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted)); | ||
437 | - iInserted = iInserted + lInserted.size(); | ||
438 | - } | ||
439 | - log.info("Inserted OrgData : " + iInserted + "건"); | ||
440 | - | ||
441 | - iDeleted = matchingInnerDelingMapper.deleteData(params); | ||
442 | - log.debug("Deleted Work Data : " + iDeleted + "건"); | ||
443 | - iInserted = matchingInnerDelingMapper.insertDataFromOriginal(params); | ||
444 | - log.info("Inserted Work Data : " + iInserted + "건"); | ||
445 | - | ||
446 | - iDeleted = matchingInnerDelingMapper.deleteDataAi(params); | ||
447 | - log.debug("Deleted Work AI Data : " + iDeleted + "건"); | ||
448 | - iInserted = matchingInnerDelingMapper.insertDataAiFromOriginal(params); | ||
449 | - log.info("Inserted Work AI Data : " + iInserted + "건"); | ||
450 | - | ||
451 | - long endTime = System.currentTimeMillis(); | ||
452 | - log.info("Create Data Ended : " + endTime); | ||
453 | - log.info("Running Time : " + (endTime - startTime) + "ms"); | ||
454 | - | ||
455 | - //작업종료에 대한 로그 업데이트 | ||
456 | - paramLog.put("exit_code", "0"); | ||
457 | - paramLog.put("exit_message", ""); | ||
458 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
459 | - } | ||
460 | - | ||
461 | - | ||
462 | - | ||
463 | - @SuppressWarnings("rawtypes") | 392 | + log.debug("Deleted OrgData : " + iDeleted + "건"); |
393 | + | ||
394 | + // 신규데이타 생성 | ||
395 | + // 매칭키에 대한 정보 (sql로 조인하여 조회하기에는 너무 느리고 데이타 중복도 발생함) | ||
396 | + List<Map> lMatchingInfo = oracleMapper.getMatchingInfo(params); | ||
397 | + Map<String, Map> mMatchingInfo = new HashMap<String, Map>(); | ||
398 | + for (Map curMap : lMatchingInfo) { | ||
399 | + String sKey = String.valueOf(curMap.get("SEQ")); | ||
400 | + mMatchingInfo.put(sKey, curMap); | ||
401 | + } | ||
402 | + | ||
403 | + List<Map> lOrgData = oracleMapper.getOriginalData(params); | ||
404 | + int iInserted = 0; | ||
405 | + int iUpdated = 0; | ||
406 | + int limit = 1000; // 1000건씩 batch | ||
407 | + List<Map> lInserted = new ArrayList<Map>(); | ||
408 | + for (Map curRec : lOrgData) { | ||
409 | + String sKey = String.valueOf(curRec.get("SEQ")); | ||
410 | + Map curMatchingInfo = mMatchingInfo.get(sKey); | ||
411 | + if (curMatchingInfo != null) { | ||
412 | + curRec.put("MATCHING_CAUSE", curMatchingInfo.get("MATCHING_CAUSE")); | ||
413 | + curRec.put("MATCH_KEY", curMatchingInfo.get("MATCH_KEY")); | ||
414 | + } | ||
415 | + lInserted.add(curRec); | ||
416 | + if (lInserted.size() == limit) { | ||
417 | + matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted)); | ||
418 | + iInserted = iInserted + lInserted.size(); | ||
419 | + lInserted.clear(); | ||
420 | + } | ||
421 | + } | ||
422 | + if (lInserted.size() > 0) { | ||
423 | + matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted)); | ||
424 | + iInserted = iInserted + lInserted.size(); | ||
425 | + } | ||
426 | + log.info("Inserted OrgData : " + iInserted + "건"); | ||
427 | + | ||
428 | + iDeleted = matchingInnerDelingMapper.deleteData(params); | ||
429 | + log.debug("Deleted Work Data : " + iDeleted + "건"); | ||
430 | + iInserted = matchingInnerDelingMapper.insertDataFromOriginal(params); | ||
431 | + log.info("Inserted Work Data : " + iInserted + "건"); | ||
432 | + | ||
433 | + | ||
434 | + /**** 매칭제외 처리 start **************************************************************************************************/ | ||
435 | + /** 1. 거래금액 = 0 */ | ||
436 | + iUpdated = matchingInnerDelingMapper.updateInitExclusion1(params); | ||
437 | + | ||
438 | + | ||
439 | + /** 2. 거래유형, 자기/상대 법인, 거래일자, 계정 이 같은 1:1 내역 금액이 +, - 로 합이 0 인 경우 */ | ||
440 | + iUpdated += matchingInnerDelingMapper.updateInitExclusion2(params); | ||
441 | + | ||
442 | + | ||
443 | + | ||
444 | + | ||
445 | + | ||
446 | + /**** 매칭제외 처리 end **************************************************************************************************/ | ||
447 | + | ||
448 | + | ||
449 | + | ||
450 | + | ||
451 | + iDeleted = matchingInnerDelingMapper.deleteDataAi(params); | ||
452 | + log.debug("Deleted Work AI Data : " + iDeleted + "건"); | ||
453 | + iInserted = matchingInnerDelingMapper.insertDataAiFromOriginal(params); | ||
454 | + log.info("Inserted Work AI Data : " + iInserted + "건"); | ||
455 | + | ||
456 | + long endTime = System.currentTimeMillis(); | ||
457 | + log.info("Create Data Ended : " + endTime); | ||
458 | + log.info("Running Time : " + (endTime - startTime) + "ms"); | ||
459 | + | ||
460 | + // 작업종료에 대한 로그 업데이트 | ||
461 | + paramLog.put("exit_code", "0"); | ||
462 | + paramLog.put("exit_message", ""); | ||
463 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
464 | + } | ||
465 | + | ||
466 | + @SuppressWarnings("rawtypes") | ||
464 | @Async("commAsync") | 467 | @Async("commAsync") |
465 | - public void returnRwsultData(String jobGroupId, Map<String, String> params) throws Exception { | ||
466 | - | ||
467 | - //Job Create Log | ||
468 | - UUID uuid = UUID.randomUUID(); | ||
469 | - HashMap<String, String> mt = new HashMap<String, String>(); | ||
470 | - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
471 | - String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
472 | - | ||
473 | - Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
474 | - paramLog.put("user_job_group", jobGroupId); | ||
475 | - paramLog.put("user_job_id", sDate); | ||
476 | - paramLog.put("user_job_name", "결과데이타리턴(" + params.toString() + ")"); | ||
477 | - matchingInnerDelingMapper.createUserJob(paramLog); | ||
478 | - | ||
479 | - long startTime = System.currentTimeMillis(); | ||
480 | - log.info("Update Data Started : " + startTime); | ||
481 | - log.debug("params=" + params.toString()); | ||
482 | - | ||
483 | - //기존데이타 초기화 | 468 | + public void returnRwsultData(String jobGroupId, Map<String, String> params) throws Exception { |
469 | + | ||
470 | + // Job Create Log | ||
471 | + UUID uuid = UUID.randomUUID(); | ||
472 | + HashMap<String, String> mt = new HashMap<String, String>(); | ||
473 | + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss"); | ||
474 | + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString(); | ||
475 | + | ||
476 | + Map<String, Object> paramLog = new HashMap<String, Object>(); | ||
477 | + paramLog.put("user_job_group", jobGroupId); | ||
478 | + paramLog.put("user_job_id", sDate); | ||
479 | + paramLog.put("user_job_name", "결과데이타리턴(" + params.toString() + ")"); | ||
480 | + matchingInnerDelingMapper.createUserJob(paramLog); | ||
481 | + | ||
482 | + long startTime = System.currentTimeMillis(); | ||
483 | + log.info("Update Data Started : " + startTime); | ||
484 | + log.debug("params=" + params.toString()); | ||
485 | + | ||
486 | + // 기존데이타 초기화 | ||
484 | int iUpdated = matchingInnerDelingMapper.updateClearNewMatchKey(params); | 487 | int iUpdated = matchingInnerDelingMapper.updateClearNewMatchKey(params); |
485 | - //새로운 매칭키 생성 | 488 | + // 새로운 매칭키 생성 |
486 | iUpdated = matchingInnerDelingMapper.updateNewMatchKey(params); | 489 | iUpdated = matchingInnerDelingMapper.updateNewMatchKey(params); |
487 | - log.debug("Updated OrgData : " + iUpdated + "건"); | ||
488 | - | ||
489 | - long endTime = System.currentTimeMillis(); | ||
490 | - log.info("Update Data Ended : " + endTime); | ||
491 | - log.info("Running Time : " + (endTime - startTime) + "ms"); | ||
492 | - | ||
493 | - | ||
494 | - //작업종료에 대한 로그 업데이트 | ||
495 | - paramLog.put("exit_code", "0"); | ||
496 | - paramLog.put("exit_message", ""); | ||
497 | - matchingInnerDelingMapper.finishUserJob(paramLog); | ||
498 | - | ||
499 | - } | 490 | + log.debug("Updated OrgData : " + iUpdated + "건"); |
491 | + | ||
492 | + long endTime = System.currentTimeMillis(); | ||
493 | + log.info("Update Data Ended : " + endTime); | ||
494 | + log.info("Running Time : " + (endTime - startTime) + "ms"); | ||
495 | + | ||
496 | + // 작업종료에 대한 로그 업데이트 | ||
497 | + paramLog.put("exit_code", "0"); | ||
498 | + paramLog.put("exit_message", ""); | ||
499 | + matchingInnerDelingMapper.finishUserJob(paramLog); | ||
500 | 500 | ||
501 | + } | ||
501 | 502 | ||
502 | } | 503 | } |
src/main/java/com/batch/util/FileUtil.java
1 | package com.batch.util; | 1 | package com.batch.util; |
2 | 2 | ||
3 | import java.io.BufferedReader; | 3 | import java.io.BufferedReader; |
4 | +import java.io.IOException; | ||
4 | import java.io.InputStreamReader; | 5 | import java.io.InputStreamReader; |
6 | +import java.io.RandomAccessFile; | ||
5 | 7 | ||
6 | import org.springframework.core.io.ClassPathResource; | 8 | import org.springframework.core.io.ClassPathResource; |
7 | 9 | ||
@@ -12,27 +14,80 @@ import com.google.gson.JsonParser; | @@ -12,27 +14,80 @@ import com.google.gson.JsonParser; | ||
12 | public class FileUtil { | 14 | public class FileUtil { |
13 | 15 | ||
14 | public static StringBuffer readFileToString(String resourceName) { | 16 | public static StringBuffer readFileToString(String resourceName) { |
15 | - StringBuffer sb = new StringBuffer(); | ||
16 | - try { | 17 | + StringBuffer sb = new StringBuffer(); |
18 | + try { | ||
17 | ClassPathResource resource = new ClassPathResource(resourceName); | 19 | ClassPathResource resource = new ClassPathResource(resourceName); |
18 | - BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); | ||
19 | - | ||
20 | - // br.readLine() 이 null 인지 검사할 때 한번 사용되므로 String 에 먼저 저장해둬야한다. | ||
21 | - String s = ""; | ||
22 | - while((s = br.readLine()) != null){ | ||
23 | - sb.append(s); | ||
24 | - } | ||
25 | - } catch (Exception e) { | ||
26 | - sb.append(e.getStackTrace()); | ||
27 | - } | ||
28 | - return sb; | 20 | + BufferedReader br = new BufferedReader(new InputStreamReader(resource.getInputStream())); |
21 | + | ||
22 | + // br.readLine() 이 null 인지 검사할 때 한번 사용되므로 String 에 먼저 저장해둬야한다. | ||
23 | + String s = ""; | ||
24 | + while ((s = br.readLine()) != null) { | ||
25 | + sb.append(s); | ||
26 | + } | ||
27 | + } catch (Exception e) { | ||
28 | + sb.append(e.getStackTrace()); | ||
29 | + } | ||
30 | + return sb; | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 파일 마지막 부터 lineCnt행 읽기 | ||
35 | + * @param resourceName | ||
36 | + * @param lineCnt | ||
37 | + * @return | ||
38 | + */ | ||
39 | + public static StringBuffer readFileLastLines(String resourceName, int lineCnt) { | ||
40 | + StringBuffer sb = new StringBuffer(); | ||
41 | + | ||
42 | +// lineCnt = 50; // test case | ||
43 | +// resourceName = "D://logs/localhost_access_log.2019-03-26.txt"; // test case | ||
44 | + | ||
45 | + if(resourceName == null || resourceName.isEmpty()) { | ||
46 | + sb.append("파일 경로가 입력되지 않았습니다."); | ||
47 | + }else if(lineCnt < 1) { | ||
48 | + sb.append("라인갯수가 입력되지 않았습니다."); | ||
49 | + }else { | ||
50 | + RandomAccessFile rf = null; | ||
51 | + | ||
52 | + try { | ||
53 | + | ||
54 | + rf = new RandomAccessFile(resourceName, "r"); | ||
55 | + long len = rf.length(); | ||
56 | + for (long i = len - 1; i >= 0; i--) { | ||
57 | + rf.seek(i); | ||
58 | + char c = (char) rf.read(); | ||
59 | + if (c == '\n') { | ||
60 | + lineCnt--; | ||
61 | + if(lineCnt < 0) { | ||
62 | + break; | ||
63 | + } | ||
64 | + } | ||
65 | + | ||
66 | + sb.insert(0, c); | ||
67 | + } | ||
68 | + | ||
69 | + } catch (Exception e) { | ||
70 | +// e.printStackTrace(); | ||
71 | + sb = new StringBuffer("유효한 파일경로가 아닙니다.("+resourceName+")"); | ||
72 | + } finally { | ||
73 | + if (rf != null) { | ||
74 | + try { | ||
75 | + rf.close(); | ||
76 | + } catch (IOException e) { | ||
77 | +// e.printStackTrace(); | ||
78 | + sb = new StringBuffer("유효한 파일경로가 아닙니다.("+resourceName+")"); | ||
79 | + } | ||
80 | + } | ||
81 | + } | ||
82 | + } | ||
83 | + return sb; | ||
29 | } | 84 | } |
30 | 85 | ||
31 | public static JsonObject strToJsonObj(String jsonString) { | 86 | public static JsonObject strToJsonObj(String jsonString) { |
32 | JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject(); | 87 | JsonObject jsonObject = JsonParser.parseString(jsonString).getAsJsonObject(); |
33 | return jsonObject; | 88 | return jsonObject; |
34 | } | 89 | } |
35 | - | 90 | + |
36 | public static Object strToObj(String jsonString, Class<?> anyClass) { | 91 | public static Object strToObj(String jsonString, Class<?> anyClass) { |
37 | Gson gson = new Gson(); | 92 | Gson gson = new Gson(); |
38 | Object convertedObject = gson.fromJson(jsonString, anyClass); | 93 | Object convertedObject = gson.fromJson(jsonString, anyClass); |
@@ -44,5 +99,5 @@ public class FileUtil { | @@ -44,5 +99,5 @@ public class FileUtil { | ||
44 | String stringObject = gson.toJson(obj); | 99 | String stringObject = gson.toJson(obj); |
45 | return stringObject; | 100 | return stringObject; |
46 | } | 101 | } |
47 | - | 102 | + |
48 | } | 103 | } |
src/main/resources/matchingSetup.json
@@ -1293,7 +1293,7 @@ | @@ -1293,7 +1293,7 @@ | ||
1293 | { | 1293 | { |
1294 | "active": true, | 1294 | "active": true, |
1295 | "type": "I-AA", | 1295 | "type": "I-AA", |
1296 | - "typeName": "자기수익(전체),상대비용(겨래월),비교(년월,거래금액)", | 1296 | + "typeName": "자기수익(전체),상대비용(거래월),비교(년월,거래금액)", |
1297 | 1297 | ||
1298 | "condOne": { | 1298 | "condOne": { |
1299 | "cond": [ | 1299 | "cond": [ |
@@ -1334,7 +1334,7 @@ | @@ -1334,7 +1334,7 @@ | ||
1334 | { | 1334 | { |
1335 | "active": true, | 1335 | "active": true, |
1336 | "type": "I-AB", | 1336 | "type": "I-AB", |
1337 | - "typeName": "자기수익(전체),상대비용(겨래일자),비교(년월,거래금액)", | 1337 | + "typeName": "자기수익(전체),상대비용(거래일자),비교(년월,거래금액)", |
1338 | 1338 | ||
1339 | "condOne": { | 1339 | "condOne": { |
1340 | "cond": [ | 1340 | "cond": [ |
@@ -1375,7 +1375,7 @@ | @@ -1375,7 +1375,7 @@ | ||
1375 | { | 1375 | { |
1376 | "active": true, | 1376 | "active": true, |
1377 | "type": "I-AC", | 1377 | "type": "I-AC", |
1378 | - "typeName": "자기비용(전체),상대수익(겨래월),비교(년월,거래금액)", | 1378 | + "typeName": "자기비용(전체),상대수익(거래월),비교(년월,거래금액)", |
1379 | 1379 | ||
1380 | "condOne": { | 1380 | "condOne": { |
1381 | "cond": [ | 1381 | "cond": [ |
@@ -1416,7 +1416,7 @@ | @@ -1416,7 +1416,7 @@ | ||
1416 | { | 1416 | { |
1417 | "active": true, | 1417 | "active": true, |
1418 | "type": "I-AD", | 1418 | "type": "I-AD", |
1419 | - "typeName": "자기비용(전체),상대수익(겨래일자),비교(년월,거래금액)", | 1419 | + "typeName": "자기비용(전체),상대수익(거래일자),비교(년월,거래금액)", |
1420 | 1420 | ||
1421 | "condOne": { | 1421 | "condOne": { |
1422 | "cond": [ | 1422 | "cond": [ |
@@ -1542,7 +1542,7 @@ | @@ -1542,7 +1542,7 @@ | ||
1542 | { | 1542 | { |
1543 | "active": true, | 1543 | "active": true, |
1544 | "type": "I-BA", | 1544 | "type": "I-BA", |
1545 | - "typeName": "자기채권(전체),상대채무(겨래월),비교(년월,거래금액)", | 1545 | + "typeName": "자기채권(전체),상대채무(거래월),비교(년월,거래금액)", |
1546 | 1546 | ||
1547 | "condOne": { | 1547 | "condOne": { |
1548 | "cond": [ | 1548 | "cond": [ |
@@ -1583,7 +1583,7 @@ | @@ -1583,7 +1583,7 @@ | ||
1583 | { | 1583 | { |
1584 | "active": true, | 1584 | "active": true, |
1585 | "type": "I-BB", | 1585 | "type": "I-BB", |
1586 | - "typeName": "자기채권(전체),상대채무(겨래일자),비교(년월,거래금액)", | 1586 | + "typeName": "자기채권(전체),상대채무(거래일자),비교(년월,거래금액)", |
1587 | 1587 | ||
1588 | "condOne": { | 1588 | "condOne": { |
1589 | "cond": [ | 1589 | "cond": [ |
@@ -1624,7 +1624,7 @@ | @@ -1624,7 +1624,7 @@ | ||
1624 | { | 1624 | { |
1625 | "active": true, | 1625 | "active": true, |
1626 | "type": "I-BC", | 1626 | "type": "I-BC", |
1627 | - "typeName": "자기채무(전체),상대채권(겨래월),비교(년월,거래금액)", | 1627 | + "typeName": "자기채무(전체),상대채권(거래월),비교(년월,거래금액)", |
1628 | 1628 | ||
1629 | "condOne": { | 1629 | "condOne": { |
1630 | "cond": [ | 1630 | "cond": [ |
@@ -1665,7 +1665,7 @@ | @@ -1665,7 +1665,7 @@ | ||
1665 | { | 1665 | { |
1666 | "active": true, | 1666 | "active": true, |
1667 | "type": "I-BD", | 1667 | "type": "I-BD", |
1668 | - "typeName": "자기채무(전체),상대채권(겨래일자),비교(년월,거래금액)", | 1668 | + "typeName": "자기채무(전체),상대채권(거래일자),비교(년월,거래금액)", |
1669 | 1669 | ||
1670 | "condOne": { | 1670 | "condOne": { |
1671 | "cond": [ | 1671 | "cond": [ |
@@ -1792,7 +1792,7 @@ | @@ -1792,7 +1792,7 @@ | ||
1792 | { | 1792 | { |
1793 | "active": true, | 1793 | "active": true, |
1794 | "type": "J-AA", | 1794 | "type": "J-AA", |
1795 | - "typeName": "자기수익(거래월),상대비용(겨래일자),비교(년월,거래금액)", | 1795 | + "typeName": "자기수익(거래월),상대비용(거래일자),비교(년월,거래금액)", |
1796 | 1796 | ||
1797 | "condOne": { | 1797 | "condOne": { |
1798 | "cond": [ | 1798 | "cond": [ |
@@ -1834,7 +1834,7 @@ | @@ -1834,7 +1834,7 @@ | ||
1834 | { | 1834 | { |
1835 | "active": true, | 1835 | "active": true, |
1836 | "type": "J-AB", | 1836 | "type": "J-AB", |
1837 | - "typeName": "자기비용(거래월),상대수익(겨래일자),비교(년월,거래금액)", | 1837 | + "typeName": "자기비용(거래월),상대수익(거래일자),비교(년월,거래금액)", |
1838 | 1838 | ||
1839 | "condOne": { | 1839 | "condOne": { |
1840 | "cond": [ | 1840 | "cond": [ |
@@ -1961,7 +1961,7 @@ | @@ -1961,7 +1961,7 @@ | ||
1961 | { | 1961 | { |
1962 | "active": true, | 1962 | "active": true, |
1963 | "type": "J-BA", | 1963 | "type": "J-BA", |
1964 | - "typeName": "자기채권(거래월),상대채무(겨래일자),비교(년월,거래금액)", | 1964 | + "typeName": "자기채권(거래월),상대채무(거래일자),비교(년월,거래금액)", |
1965 | 1965 | ||
1966 | "condOne": { | 1966 | "condOne": { |
1967 | "cond": [ | 1967 | "cond": [ |
@@ -2003,7 +2003,7 @@ | @@ -2003,7 +2003,7 @@ | ||
2003 | { | 2003 | { |
2004 | "active": true, | 2004 | "active": true, |
2005 | "type": "J-BB", | 2005 | "type": "J-BB", |
2006 | - "typeName": "자기채무(거래월),상대채권(겨래일자),비교(년월,거래금액)", | 2006 | + "typeName": "자기채무(거래월),상대채권(거래일자),비교(년월,거래금액)", |
2007 | 2007 | ||
2008 | "condOne": { | 2008 | "condOne": { |
2009 | "cond": [ | 2009 | "cond": [ |
@@ -2184,7 +2184,7 @@ | @@ -2184,7 +2184,7 @@ | ||
2184 | { | 2184 | { |
2185 | "active": true, | 2185 | "active": true, |
2186 | "type": "K-AB", | 2186 | "type": "K-AB", |
2187 | - "typeName": "자기비용(적요),상대수익(겨래일자),비교(년월,거래금액)", | 2187 | + "typeName": "자기비용(적요),상대수익(거래일자),비교(년월,거래금액)", |
2188 | 2188 | ||
2189 | "condOne": { | 2189 | "condOne": { |
2190 | "cond": [ | 2190 | "cond": [ |
@@ -2310,7 +2310,7 @@ | @@ -2310,7 +2310,7 @@ | ||
2310 | { | 2310 | { |
2311 | "active": true, | 2311 | "active": true, |
2312 | "type": "K-BA", | 2312 | "type": "K-BA", |
2313 | - "typeName": "자기채권(적요),상대채무(겨래일자),비교(년월,거래금액)", | 2313 | + "typeName": "자기채권(적요),상대채무(거래일자),비교(년월,거래금액)", |
2314 | 2314 | ||
2315 | "condOne": { | 2315 | "condOne": { |
2316 | "cond": [ | 2316 | "cond": [ |
@@ -2352,7 +2352,7 @@ | @@ -2352,7 +2352,7 @@ | ||
2352 | { | 2352 | { |
2353 | "active": true, | 2353 | "active": true, |
2354 | "type": "K-BB", | 2354 | "type": "K-BB", |
2355 | - "typeName": "자기채무(적요),상대채권(겨래일자),비교(년월,거래금액)", | 2355 | + "typeName": "자기채무(적요),상대채권(거래일자),비교(년월,거래금액)", |
2356 | 2356 | ||
2357 | "condOne": { | 2357 | "condOne": { |
2358 | "cond": [ | 2358 | "cond": [ |
src/main/resources/mybatis/primaryMapper/MatchingInnerDelingMapper.xml
@@ -660,4 +660,50 @@ | @@ -660,4 +660,50 @@ | ||
660 | and accnut_ym = #{accnutYm} | 660 | and accnut_ym = #{accnutYm} |
661 | </select> | 661 | </select> |
662 | 662 | ||
663 | + | ||
664 | + | ||
665 | + | ||
666 | + <update id="updateInitExclusion1" parameterType="map"> | ||
667 | + update batch_tbcr_inner_delng | ||
668 | + set | ||
669 | + MTCH_SYS = 'EXCLUSION' | ||
670 | + , MTCH_TY = 'EXCLUSION' | ||
671 | + , MTCH_TY_NM = 'EXCLUSION' | ||
672 | + where sys_se = #{sysSe} | ||
673 | + and accnut_ym = #{accnutYm} | ||
674 | + and mtch_ty is null | ||
675 | + and delng_amt = 0 | ||
676 | + </update> | ||
677 | + | ||
678 | + | ||
679 | + <update id="updateInitExclusion2" parameterType="map"> | ||
680 | + merge into batch_tbcr_inner_delng a | ||
681 | + using ( | ||
682 | + with ht_data as ( | ||
683 | + select count(*) over(partition by sys_se, accnut_ym, dta_ty, cpr_code, partn_cpr, cnnc_acnt_code, delng_de, delng_crncy) as cnt | ||
684 | + , sum(delng_amt) over(partition by sys_se, accnut_ym, dta_ty, cpr_code, partn_cpr, cnnc_acnt_code, delng_de, delng_crncy) as sum_amt | ||
685 | + , a.* | ||
686 | + from batch_tbcr_inner_delng a | ||
687 | + where sys_se = #{sysSe} | ||
688 | + and accnut_ym = #{accnutYm} | ||
689 | + and mtch_ty is null | ||
690 | + and delng_amt != 0 | ||
691 | + ) | ||
692 | + select sys_se, accnut_ym, sn | ||
693 | + from ht_data | ||
694 | + where cnt = 2 | ||
695 | + and sum_amt = 0 | ||
696 | + ) b | ||
697 | + on ( | ||
698 | + b.sys_se = a.sys_se | ||
699 | + and b.accnut_ym = a.accnut_ym | ||
700 | + and b.sn = a.sn | ||
701 | + ) | ||
702 | + when matched then | ||
703 | + update | ||
704 | + set MTCH_SYS = 'EXCLUSION' | ||
705 | + , MTCH_TY = 'EXCLUSION' | ||
706 | + , MTCH_TY_NM = 'EXCLUSION' | ||
707 | + </update> | ||
708 | + | ||
663 | </mapper> | 709 | </mapper> |
664 | \ No newline at end of file | 710 | \ No newline at end of file |