Commit fb057d1ea341a2e5272a1e1fb2bbc4fda0fefc12

Authored by 함상기
1 parent 7eae5008

.

src/main/java/com/batch/service/JobService.java
@@ -53,6 +53,9 @@ public class JobService { @@ -53,6 +53,9 @@ public class JobService {
53 53
54 @Value("${matching.auto.exceptListByComma}") 54 @Value("${matching.auto.exceptListByComma}")
55 String sExceptMatchType; 55 String sExceptMatchType;
  56 +
  57 + @Value("${thread.ai.count}")
  58 + BigDecimal bdAiAsyncCount;
56 59
57 @Value("${thread.ai.count.rowmax}") 60 @Value("${thread.ai.count.rowmax}")
58 BigDecimal bdAiAsyncMaxRowCount; 61 BigDecimal bdAiAsyncMaxRowCount;
@@ -312,6 +315,7 @@ public class JobService { @@ -312,6 +315,7 @@ public class JobService {
312 matchingInnerDelingMapper.createUserJob(paramLog); 315 matchingInnerDelingMapper.createUserJob(paramLog);
313 316
314 List<ThreadAiMatching> lThread = new ArrayList<ThreadAiMatching>(); 317 List<ThreadAiMatching> lThread = new ArrayList<ThreadAiMatching>();
  318 + BigDecimal bdTotalThread = BigDecimal.ZERO;
315 for(Map curMap : retData) { 319 for(Map curMap : retData) {
316 Map<String, Object> curMParams = new HashMap<String, Object>(); 320 Map<String, Object> curMParams = new HashMap<String, Object>();
317 curMParams.putAll(curMap); 321 curMParams.putAll(curMap);
@@ -328,10 +332,12 @@ public class JobService { @@ -328,10 +332,12 @@ public class JobService {
328 sPythonAiTarget 332 sPythonAiTarget
329 ); 333 );
330 threadAiMatching.start(); 334 threadAiMatching.start();
  335 + bdTotalThread = bdTotalThread.add(BigDecimal.ONE);
331 336
332 //전체카운트가 처리가능카운트를 넘어설때 337 //전체카운트가 처리가능카운트를 넘어설때
333 - if (bdCurrentRowCount.compareTo(bdAiAsyncMaxRowCount) > -1) { 338 + if (bdCurrentRowCount.compareTo(bdAiAsyncMaxRowCount) > -1 || bdTotalThread.compareTo(bdAiAsyncCount) > -1) {
334 bdCurrentRowCount = BigDecimal.ZERO; 339 bdCurrentRowCount = BigDecimal.ZERO;
  340 + bdTotalThread = BigDecimal.ZERO;
335 341
336 //현재 작업그룹이 종료가 되었는지 체크해서 종료시 카운트 초기화 하고 다음작업을 한다. 342 //현재 작업그룹이 종료가 되었는지 체크해서 종료시 카운트 초기화 하고 다음작업을 한다.
337 boolean blnStatus = true; 343 boolean blnStatus = true;
@@ -340,8 +346,10 @@ public class JobService { @@ -340,8 +346,10 @@ public class JobService {
340 do { 346 do {
341 Map<String, Object> mParam = new HashMap<String, Object>(); 347 Map<String, Object> mParam = new HashMap<String, Object>();
342 mParam.put("userJobGroup", jobGroupId); 348 mParam.put("userJobGroup", jobGroupId);
  349 + mParam.put("exceptJobId", sDate); // 메인 User Job Id 제외
343 List<Map> lmJob = matchingInnerDelingMapper.getUserJobStatus(mParam); 350 List<Map> lmJob = matchingInnerDelingMapper.getUserJobStatus(mParam);
344 for (Map curJob : lmJob) { 351 for (Map curJob : lmJob) {
  352 + blnStatus = true;
345 String ScurStatus = (String) curJob.get("status"); 353 String ScurStatus = (String) curJob.get("status");
346 if (!"Finished".equalsIgnoreCase(ScurStatus)) { 354 if (!"Finished".equalsIgnoreCase(ScurStatus)) {
347 blnStatus = false; 355 blnStatus = false;
@@ -350,7 +358,7 @@ public class JobService { @@ -350,7 +358,7 @@ public class JobService {
350 break; 358 break;
351 } 359 }
352 } 360 }
353 - } while (!blnStatus && iTotalWait < bdAiAsyncTotalWaitTime.intValue()); //전체 기다리는 시간까지 체크 361 + } while (!blnStatus && iTotalWait < (bdAiAsyncTotalWaitTime.intValue() * 1000)); //전체 기다리는 시간까지 체크
354 log.info("Next Thread Group Processing"); 362 log.info("Next Thread Group Processing");
355 } 363 }
356 } 364 }
src/main/resources/mybatis/primaryMapper/MatchingInnerDelingMapper.xml
@@ -659,6 +659,9 @@ @@ -659,6 +659,9 @@
659 public.batch_user_job_status 659 public.batch_user_job_status
660 WHERE 660 WHERE
661 user_job_group = #{userJobGroup} 661 user_job_group = #{userJobGroup}
  662 + <if test='exceptJobId != null and !exceptJobId.equals("")'>
  663 + and user_job_id != #{exceptJobId}
  664 + </if>
662 ORDER BY 665 ORDER BY
663 user_job_id ASC 666 user_job_id ASC
664 </select> 667 </select>