Commit 4c27234c1bb32561cc6a8c717bfc1ad8dbab000e

Authored by ggun12
1 parent b490e7c9

* 자동일치 Sequence

StatisticsUtil.getMtchNum(); /** 일치key  */

* EX 매칭

	2:3, 3:2, 3:3, 4:1, 1:4
	케이스 추가
src/main/java/com/batch/config/MatchingItemProcessorAuto.java
@@ -12,6 +12,7 @@ import org.springframework.stereotype.Component; @@ -12,6 +12,7 @@ import org.springframework.stereotype.Component;
12 import com.batch.config.MatchingSetup.Cond; 12 import com.batch.config.MatchingSetup.Cond;
13 import com.batch.config.MatchingSetup.Matching; 13 import com.batch.config.MatchingSetup.Matching;
14 import com.batch.mapper.primary.MatchingInnerDelingMapper; 14 import com.batch.mapper.primary.MatchingInnerDelingMapper;
  15 +import com.batch.util.StatisticsUtil;
15 16
16 import lombok.RequiredArgsConstructor; 17 import lombok.RequiredArgsConstructor;
17 import lombok.extern.slf4j.Slf4j; 18 import lombok.extern.slf4j.Slf4j;
@@ -37,7 +38,7 @@ public class MatchingItemProcessorAuto implements ItemProcessor<Map, Map> { @@ -37,7 +38,7 @@ public class MatchingItemProcessorAuto implements ItemProcessor<Map, Map> {
37 List<String> lCompareField = matching.getCompareField(); 38 List<String> lCompareField = matching.getCompareField();
38 String mtchType = matching.getType(); 39 String mtchType = matching.getType();
39 String mtchTypeName = matching.getTypeName(); 40 String mtchTypeName = matching.getTypeName();
40 - int mtchNumber = 0; 41 + long mtchNumber = 0;
41 int iUpdated = 0; 42 int iUpdated = 0;
42 43
43 log.info("CustomItemProcessorA.params : " + params.toString()); 44 log.info("CustomItemProcessorA.params : " + params.toString());
@@ -124,7 +125,9 @@ public class MatchingItemProcessorAuto implements ItemProcessor&lt;Map, Map&gt; { @@ -124,7 +125,9 @@ public class MatchingItemProcessorAuto implements ItemProcessor&lt;Map, Map&gt; {
124 List<Map> lMapTwo = mMatchingDataTwo.get(curKey); 125 List<Map> lMapTwo = mMatchingDataTwo.get(curKey);
125 126
126 int iMin = Math.min(lMapOne.size(), lMapTwo.size()); 127 int iMin = Math.min(lMapOne.size(), lMapTwo.size());
127 - if (iMin > 0) mtchNumber++; 128 + if (iMin > 0) {
  129 + mtchNumber = StatisticsUtil.getMtchNum(); /** 일치key Sequence */
  130 + }
128 for (int i=0; i<iMin; i++) { 131 for (int i=0; i<iMin; i++) {
129 lMapOne.get(i).put("mtchType", mtchType); 132 lMapOne.get(i).put("mtchType", mtchType);
130 lMapOne.get(i).put("mtchTypeName", mtchTypeName); 133 lMapOne.get(i).put("mtchTypeName", mtchTypeName);
@@ -209,7 +212,7 @@ public class MatchingItemProcessorAuto implements ItemProcessor&lt;Map, Map&gt; { @@ -209,7 +212,7 @@ public class MatchingItemProcessorAuto implements ItemProcessor&lt;Map, Map&gt; {
209 matchingInnerDelingMapper.setResult(Map.of("itemList", lUpdated)); 212 matchingInnerDelingMapper.setResult(Map.of("itemList", lUpdated));
210 iUpdated = iUpdated + lUpdated.size(); 213 iUpdated = iUpdated + lUpdated.size();
211 } 214 }
212 - log.debug("Updated OrgData : " + iUpdated + "건"); 215 + log.info("Updated OrgData : " + iUpdated + "건, mtchNumber = " + mtchNumber);
213 216
214 //작업이 정상적으로 작동 되었을 경우 현재 처리하고 있는 데이타 그대로 넘겨준다. 217 //작업이 정상적으로 작동 되었을 경우 현재 처리하고 있는 데이타 그대로 넘겨준다.
215 return item; 218 return item;
src/main/java/com/batch/service/JobService.java
@@ -33,7 +33,7 @@ import com.batch.config.MatchingSetup.Matching; @@ -33,7 +33,7 @@ import com.batch.config.MatchingSetup.Matching;
33 import com.batch.mapper.primary.MatchingInnerDelingMapper; 33 import com.batch.mapper.primary.MatchingInnerDelingMapper;
34 import com.batch.mapper.secondary.OracleMapper; 34 import com.batch.mapper.secondary.OracleMapper;
35 import com.batch.util.FileUtil; 35 import com.batch.util.FileUtil;
36 - 36 +import com.batch.util.StatisticsUtil;
37 import com.batch.service.JobService; 37 import com.batch.service.JobService;
38 import lombok.extern.slf4j.Slf4j; 38 import lombok.extern.slf4j.Slf4j;
39 39
@@ -98,6 +98,9 @@ public class JobService { @@ -98,6 +98,9 @@ public class JobService {
98 } 98 }
99 } 99 }
100 100
  101 + /** 일치key 초기화 */
  102 + StatisticsUtil.initMtchNum();
  103 +
101 for (String sJobType : lJobType) { 104 for (String sJobType : lJobType) {
102 log.info("[" + sThreadName + "]Current running job type: " + sJobType); 105 log.info("[" + sThreadName + "]Current running job type: " + sJobType);
103 JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params); 106 JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params);
@@ -216,7 +219,7 @@ public class JobService { @@ -216,7 +219,7 @@ public class JobService {
216 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber); 219 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber);
217 } 220 }
218 221
219 - // 3건씩 매칭일 경우 최대 5000건 까지 222 + // 3건씩 매칭일 경우 최대 2000건 까지
220 for (int i = 0; i < 2000; i = i + 100) { 223 for (int i = 0; i < 2000; i = i + 100) {
221 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber); 224 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber);
222 } 225 }
@@ -224,6 +227,27 @@ public class JobService { @@ -224,6 +227,27 @@ public class JobService {
224 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber); 227 mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber);
225 } 228 }
226 229
  230 +
  231 + for (int i = 0; i < 2000; i = i + 100) {
  232 + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 2, 3, i, 0, mtchNumber);
  233 + }
  234 +
  235 + for (int i = 0; i < 2000; i = i + 100) {
  236 + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 2, i, 0, mtchNumber);
  237 + }
  238 +
  239 + for (int i = 0; i < 2000; i = i + 100) {
  240 + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 3, 3, i, 0, mtchNumber);
  241 + }
  242 +
  243 + // 3건이상 매칭일 경우 최대 1000건 까지
  244 + for (int i = 0; i < 1000; i = i + 25) {
  245 + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 1, 4, 0, i, mtchNumber);
  246 + }
  247 + for (int i = 0; i < 1000; i = i + 25) {
  248 + mtchNumber = matchingExtraProcessorAuto.process(paramRec, 4, 1, 0, i, mtchNumber);
  249 + }
  250 +
227 long endTime = System.currentTimeMillis(); 251 long endTime = System.currentTimeMillis();
228 log.info( 252 log.info(
229 "extra [" + sThreadName + " : " + sDate + "]Job Ended: " + endTime + " mtchNumber = " + mtchNumber); 253 "extra [" + sThreadName + " : " + sDate + "]Job Ended: " + endTime + " mtchNumber = " + mtchNumber);
src/main/java/com/batch/util/StatisticsUtil.java
@@ -25,6 +25,16 @@ public class StatisticsUtil { @@ -25,6 +25,16 @@ public class StatisticsUtil {
25 // log.info("resultAll=" + resultAll.toString()); 25 // log.info("resultAll=" + resultAll.toString());
26 // } 26 // }
27 27
  28 + private static long mtch_num = 0;
  29 +
  30 + public static long getMtchNum() {
  31 + return ++mtch_num;
  32 + }
  33 +
  34 + public static void initMtchNum() {
  35 + mtch_num = 0;
  36 + }
  37 +
28 /** 38 /**
29 * 조합 구하기 39 * 조합 구하기
30 * 40 *