Blame view

src/main/java/com/batch/service/JobService.java 19.9 KB
8dc487b1   함상기   Init Version - 20...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  package com.batch.service;
  
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Date;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import java.util.UUID;
  
  import org.springframework.batch.core.BatchStatus;
  import org.springframework.batch.core.Job;
  import org.springframework.batch.core.JobExecution;
  import org.springframework.batch.core.JobParameters;
  import org.springframework.batch.core.JobParametersBuilder;
  import org.springframework.batch.core.JobParametersInvalidException;
  import org.springframework.batch.core.launch.JobLauncher;
  import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
  import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
  import org.springframework.batch.core.repository.JobRestartException;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.context.ApplicationContext;
  import org.springframework.scheduling.annotation.Async;
  import org.springframework.stereotype.Service;
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
27
28
  import org.springframework.transaction.annotation.Isolation;
  import org.springframework.transaction.annotation.Transactional;
8dc487b1   함상기   Init Version - 20...
29
30
31
32
33
34
35
36
37
38
  import org.zeroturnaround.exec.ProcessExecutor;
  import org.zeroturnaround.exec.stream.LogOutputStream;
  
  import com.batch.config.MatchingExtraProcessorAuto;
  import com.batch.config.MatchingSetup;
  import com.batch.config.MatchingSetup.Matching;
  import com.batch.mapper.primary.MatchingInnerDelingMapper;
  import com.batch.mapper.secondary.OracleMapper;
  import com.batch.util.FileUtil;
  
78928007   함상기   20240305
39
  import com.batch.service.JobService;
8dc487b1   함상기   Init Version - 20...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  import lombok.extern.slf4j.Slf4j;
  
  @Slf4j
  @Service
  public class JobService {
  
  	@Value("${pytyon.path}")
  	String sPythonPrg;
  
  	@Value("${python.ai.target}")
  	String sPythonAiTarget;
  	
      @Autowired
      private JobLauncher jobLauncher;
  
      @Autowired
      private ApplicationContext context;
  
      @Autowired
      private MatchingInnerDelingMapper matchingInnerDelingMapper;
  
      @Autowired
      private OracleMapper oracleMapper;
      
      
      @SuppressWarnings("rawtypes")
  	@Async("commAsync")
78928007   함상기   20240305
67
      public void matchingJob(String jobGroupId, Map<String, String> params) throws Exception {
8dc487b1   함상기   Init Version - 20...
68
      	
78928007   함상기   20240305
69
70
71
72
73
74
75
76
77
78
79
80
81
      	//Job Create Log
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
      	    	
      	Map<String, Object> paramLog = new HashMap<String, Object>();
      	paramLog.put("user_job_group", jobGroupId);
      	paramLog.put("user_job_id", sDate);
      	paramLog.put("user_job_name", "자동매칭(" + params.toString() + ")");
      	matchingInnerDelingMapper.createUserJob(paramLog);
      	
      	String sThreadName = Thread.currentThread().getName();
8dc487b1   함상기   Init Version - 20...
82
      	long startTime = System.currentTimeMillis();
78928007   함상기   20240305
83
84
      	log.info("[" + sThreadName + "]Job Started : " + startTime);
      	log.debug("[" + sThreadName + "]params=" + params.toString());
8dc487b1   함상기   Init Version - 20...
85
86
87
88
89
90
91
92
93
94
95
96
97
98
      	
      	StringBuffer sb = FileUtil.readFileToString("matchingSetup.json");
      	MatchingSetup matchingSetup = (MatchingSetup) FileUtil.strToObj(sb.toString(), MatchingSetup.class);
  
      	String sJobTypeList = params.get("jobType").toUpperCase();
      	List<String> lJobType = Arrays.asList(sJobTypeList != null?sJobTypeList.split(","):new String[0]);
  
      	//파라미터가 ALL일 경우 ALL 대신 등록된 모든 Type를 넣어준다.
      	if (lJobType.size() > 0 && lJobType.indexOf("ALL") != -1) {
      		lJobType = new ArrayList();
      		for (Matching matching : matchingSetup.getMatchingSetup()) {
      			if (matching.getActive()) {
      				lJobType.add(matching.getType());
      			} else {
78928007   함상기   20240305
99
      				log.info("[" + sThreadName + "]JobType(" + matching.getType() + ") is Disabled");
8dc487b1   함상기   Init Version - 20...
100
101
102
103
104
105
      			}
      		}
      	}
      	
      	
      	for (String sJobType : lJobType) {
78928007   함상기   20240305
106
          	log.info("[" + sThreadName + "]Current running job type: " + sJobType);
8dc487b1   함상기   Init Version - 20...
107
108
109
110
111
112
113
          	JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params);
          	if (!jobExe.getStatus().equals(BatchStatus.COMPLETED)) {
          		throw new Exception("Job execution error : Batchstatus(" + jobExe.getStatus() + "), ExitStatus(" + jobExe.getExitStatus() + ")" );
          	}
      	}
      	
      	long endTime = System.currentTimeMillis();
78928007   함상기   20240305
114
115
116
      	log.info("[" + sThreadName + "]Job Type : " + lJobType.toString());
      	log.info("[" + sThreadName + "]Job Ended: " + endTime);
      	log.info("[" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
8dc487b1   함상기   Init Version - 20...
117
  
78928007   함상기   20240305
118
119
120
121
122
      	//작업종료에 대한 로그 업데이트
      	paramLog.put("exit_code", "0");
      	paramLog.put("exit_message", "");    	
      	matchingInnerDelingMapper.finishUserJob(paramLog);
      	
8dc487b1   함상기   Init Version - 20...
123
124
125
      }
      
  
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
126
127
128
  
  
  
8dc487b1   함상기   Init Version - 20...
129
      @SuppressWarnings("rawtypes")
78928007   함상기   20240305
130
  	@Async("extAsync")
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
131
132
133
      public void extraJobSub(String jobGroupId, Map paramRec, int key) throws Exception {
  
      	int mtchNumber = key;
78928007   함상기   20240305
134
135
136
137
138
139
140
141
142
143
      	//Job Create Log
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
      	    	
      	Map<String, Object> paramLog = new HashMap<String, Object>();
      	paramLog.put("user_job_group", jobGroupId);
      	paramLog.put("user_job_id", sDate);
      	paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")");
8dc487b1   함상기   Init Version - 20...
144
      	
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
145
146
      	matchingInnerDelingMapper.createUserJob(paramLog);
  
78928007   함상기   20240305
147
      	String sThreadName = Thread.currentThread().getName();
8dc487b1   함상기   Init Version - 20...
148
      	long startTime = System.currentTimeMillis();
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
149
      	log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString());
9c28833f   ggun12   aiJobSub : 작업종료 처...
150
      	log.debug("extra [" + sThreadName + "]params=" + paramRec.toString());
8dc487b1   함상기   Init Version - 20...
151
152
153
154
155
  
      	MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper);
      	
      	//2건씩 합산 매칭일 경우 최대 20000건 까지
      	for (int i=0; i<20000;i=i+1000) {
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
156
          	matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber);
8dc487b1   함상기   Init Version - 20...
157
158
      	}
      	for (int i=0; i<20000;i=i+1000) {
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
159
          	matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber);
8dc487b1   함상기   Init Version - 20...
160
161
      	}
      	for (int i=0; i<20000;i=i+1000) {
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
162
          	matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber);
8dc487b1   함상기   Init Version - 20...
163
164
165
      	}
      	
      	//3건씩 매칭일 경우 최대 5000건 까지
78928007   함상기   20240305
166
      	for (int i=0; i<2000;i=i+100) {
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
167
          	matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber);
8dc487b1   함상기   Init Version - 20...
168
      	}
78928007   함상기   20240305
169
      	for (int i=0; i<2000;i=i+100) {
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
170
          	matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber);
8dc487b1   함상기   Init Version - 20...
171
      	}
8dc487b1   함상기   Init Version - 20...
172
173
      	
      	long endTime = System.currentTimeMillis();
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
174
      	log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime);
9c28833f   ggun12   aiJobSub : 작업종료 처...
175
      	log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
8dc487b1   함상기   Init Version - 20...
176
  
78928007   함상기   20240305
177
178
179
180
181
      	//작업종료에 대한 로그 업데이트
      	paramLog.put("exit_code", "0");
      	paramLog.put("exit_message", "");    	
      	matchingInnerDelingMapper.finishUserJob(paramLog);
      	
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
      }
  
  
      @SuppressWarnings("rawtypes")
  	@Async("extAsync")
      public void extraJobSub2(String jobGroupId, Map paramRec) throws Exception {
      	
  
      	List<Map> retData = matchingInnerDelingMapper.getCustomItemReadData(paramRec);
  
      	int mtchNumber = 0;
      	paramRec.put("conds", "T");
      	for(Map curMap : retData) {
      		paramRec.putAll(curMap);
  	    	//Job Create Log
  	    	UUID uuid = UUID.randomUUID();
  	    	HashMap<String, String> mt = new HashMap<String, String>();
  	        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
  	        String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
  	    	    	
  	    	Map<String, Object> paramLog = new HashMap<String, Object>();
  	    	paramLog.put("user_job_group", jobGroupId);
  	    	paramLog.put("user_job_id", sDate);
  	    	paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")");
  	    	try {
  	    	matchingInnerDelingMapper.createUserJob(paramLog);
  	    	}catch(Exception e) {
  	    		log.info("createUserJob Exception : "+e.getMessage());
  	    	}
  	    	String sThreadName = Thread.currentThread().getName();
  	    	long startTime = System.currentTimeMillis();
  	    	log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString());
  	    	log.debug("extra [" + sThreadName + "]params=" + paramRec.toString());
  	
  	    	MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper);
  	    	
  	    	//2건씩 합산 매칭일 경우 최대 20000건 까지
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber);
  	    	}
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber);
  	    	}
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber);
  	    	}
  	    	
  	    	//3건씩 매칭일 경우 최대 5000건 까지
  	    	for (int i=0; i<2000;i=i+100) {
  	        	matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber);
  	    	}
  	    	for (int i=0; i<2000;i=i+100) {
  	        	matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber);
  	    	}
  	    	
  	    	long endTime = System.currentTimeMillis();
  	    	log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime);
  	    	log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
  	
  	    	//작업종료에 대한 로그 업데이트
  	    	paramLog.put("exit_code", "0");
  	    	paramLog.put("exit_message", "");    	
  	    	matchingInnerDelingMapper.finishUserJob(paramLog);
      	
      	}
      	
  
      	paramRec.put("conds", "B");
      	for(Map curMap : retData) {
      		paramRec.putAll(curMap);
      	
  	    	//Job Create Log
  	    	UUID uuid = UUID.randomUUID();
  	    	HashMap<String, String> mt = new HashMap<String, String>();
  	        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
  	        String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
  	    	    	
  	    	Map<String, Object> paramLog = new HashMap<String, Object>();
  	    	paramLog.put("user_job_group", jobGroupId);
  	    	paramLog.put("user_job_id", sDate);
  	    	paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")");
  	    	try {
  	    	matchingInnerDelingMapper.createUserJob(paramLog);
  	    	}catch(Exception e) {
  	    		log.info("createUserJob Exception : "+e.getMessage());
  	    	}
  	    	String sThreadName = Thread.currentThread().getName();
  	    	long startTime = System.currentTimeMillis();
  	    	log.info("extra [" + sThreadName + " : "+sDate+"]Job Started : " + startTime + "]params=" + paramRec.toString());
  	    	log.debug("extra [" + sThreadName + "]params=" + paramRec.toString());
  	
  	    	MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper);
  	    	
  	    	//2건씩 합산 매칭일 경우 최대 20000건 까지
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 1, 2, 0, i, mtchNumber);
  	    	}
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 2, 1, i, 0, mtchNumber);
  	    	}
  	    	for (int i=0; i<20000;i=i+1000) {
  	        	matchingExtraProcessorAuto.process(paramRec, 2, 2, i, i, mtchNumber);
  	    	}
  	    	
  	    	//3건씩 매칭일 경우 최대 5000건 까지
  	    	for (int i=0; i<2000;i=i+100) {
  	        	matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i, mtchNumber);
  	    	}
  	    	for (int i=0; i<2000;i=i+100) {
  	        	matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0, mtchNumber);
  	    	}
  	    	
  	    	long endTime = System.currentTimeMillis();
  	    	log.info("extra [" + sThreadName + " : "+sDate+"]Job Ended: " + endTime);
  	    	log.info("extra [" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
  	
  	    	//작업종료에 대한 로그 업데이트
  	    	paramLog.put("exit_code", "0");
  	    	paramLog.put("exit_message", "");
  	    	matchingInnerDelingMapper.finishUserJob(paramLog);
      	
      	}
      	
8dc487b1   함상기   Init Version - 20...
305
306
307
308
      }    
  
      @SuppressWarnings("rawtypes")
  	@Async("aiAsync")
78928007   함상기   20240305
309
      public void aiJobSub(String jobGroupId, Map paramRec) throws Exception {
8dc487b1   함상기   Init Version - 20...
310
311
312
313
314
315
316
317
318
      	
  
      	//Job Create Log
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
      	
      	Map<String, Object> paramLog = new HashMap<String, Object>();
78928007   함상기   20240305
319
      	paramLog.put("user_job_group", jobGroupId);
8dc487b1   함상기   Init Version - 20...
320
321
322
323
324
325
      	paramLog.put("user_job_id", sDate);
      	paramLog.put("user_job_name", "AI매칭(" + paramRec.toString() + ")");
      	matchingInnerDelingMapper.createUserJob(paramLog);
  
      	
      	long startTime = System.currentTimeMillis();
9c28833f   ggun12   aiJobSub : 작업종료 처...
326
327
      	log.info("ai Job Started : " + startTime);
      	log.debug("ai Job params=" + paramRec.toString());
8dc487b1   함상기   Init Version - 20...
328
329
330
331
332
333
      	
      	String sSysSe = (String) paramRec.get("sys_se");
      	String sAccnutYm = (String) paramRec.get("accnut_ym");
      	String sCprCode = (String) paramRec.get("cpr_code");
      	String sPartCpr = (String) paramRec.get("partn_cpr");
      	String sDelngCrncy = (String) paramRec.get("delng_crncy");
78928007   함상기   20240305
334
335
336
      	
      	String sThreadName = Thread.currentThread().getName();
      	
8dc487b1   함상기   Init Version - 20...
337
338
      	log.debug("call python");
      	new ProcessExecutor()
9c28833f   ggun12   aiJobSub : 작업종료 처...
339
  	    	.command(sPythonPrg, sPythonAiTarget, sDate, sSysSe, sAccnutYm, sCprCode, sPartCpr, sDelngCrncy)
8dc487b1   함상기   Init Version - 20...
340
341
342
343
344
345
346
347
348
  	        .redirectOutput(new LogOutputStream() {
  	          @Override
  	          protected void processLine(String line) {
  	            log.info(line);
  	          }
  	        })
  	        .execute();   	
       	
      	long endTime = System.currentTimeMillis();
9c28833f   ggun12   aiJobSub : 작업종료 처...
349
350
      	log.info("ai Job Ended: " + endTime);
      	log.info("ai Job Running Time : " + (endTime - startTime) + "ms");
8dc487b1   함상기   Init Version - 20...
351
352
  
      	
9c28833f   ggun12   aiJobSub : 작업종료 처...
353
354
355
356
  //    	//작업종료에 대한 로그 업데이트
  //    	paramLog.put("exit_code", "0");
  //    	paramLog.put("exit_message", "");    	
  //    	matchingInnerDelingMapper.finishUserJob(paramLog);
8dc487b1   함상기   Init Version - 20...
357
358
      	
      }
8dc487b1   함상기   Init Version - 20...
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
      
      
      public JobExecution invokeJob(String jobName, String jobType, Map<String, String> params) throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
  
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          final String date = dateFormat.format(new Date()) + ":" + uuid.toString();
          JobParameters jobParameters = new JobParametersBuilder()
                  .addString("syncDate", date)
                  .addString("jobType", jobType)
                  .addString("sysSe", params.get("sysSe"))
                  .addString("accnutYm", params.get("accnutYm"))
                  .addString("searchCond", params.get("searchCond"))
                  .toJobParameters(); 
  
          var jobToStart = context.getBean(jobName, Job.class);
          JobExecution jobExe = jobLauncher.run(jobToStart, jobParameters);
          
          return jobExe;
      }
      
      
      
      @SuppressWarnings("rawtypes")
  	@Async("commAsync")
78928007   함상기   20240305
385
      public void createData(String jobGroupId, Map<String, String> params) throws Exception {
8dc487b1   함상기   Init Version - 20...
386
387
388
389
390
391
392
393
      	
      	//Job Create Log
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
      	
      	Map<String, Object> paramLog = new HashMap<String, Object>();
78928007   함상기   20240305
394
      	paramLog.put("user_job_group", jobGroupId);
8dc487b1   함상기   Init Version - 20...
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
      	paramLog.put("user_job_id", sDate);
      	paramLog.put("user_job_name", "작업데이타생성(" + params.toString() + ")");
      	matchingInnerDelingMapper.createUserJob(paramLog);
  
      	
      	long startTime = System.currentTimeMillis();
      	log.info("Create Data Started : " + startTime);
      	log.debug("params=" + params.toString());
  
      	//기존데이타 삭제
  		int iDeleted = matchingInnerDelingMapper.deleteOriginalData(params);
      	log.debug("Deleted OrgData : " + iDeleted + "건");
      	
  		//신규데이타 생성
      	//매칭키에 대한 정보 (sql로 조인하여 조회하기에는 너무 느리고 데이타 중복도 발생함)
      	List<Map> lMatchingInfo = oracleMapper.getMatchingInfo(params);
      	Map<String, Map> mMatchingInfo = new HashMap<String, Map>();
      	for (Map curMap : lMatchingInfo) {
      		String sKey = String.valueOf(curMap.get("SEQ"));
      		mMatchingInfo.put(sKey, curMap);
      	}
  
      	List<Map> lOrgData = oracleMapper.getOriginalData(params);    	
      	int iInserted = 0;
      	int limit = 1000; //1000건씩 batch
      	List<Map> lInserted = new ArrayList<Map>();
      	for (Map curRec : lOrgData) {
      		String sKey = String.valueOf(curRec.get("SEQ"));
      		Map curMatchingInfo = mMatchingInfo.get(sKey);
      		if (curMatchingInfo != null) {
          		curRec.put("MATCHING_CAUSE", curMatchingInfo.get("MATCHING_CAUSE"));
          		curRec.put("MATCH_KEY", curMatchingInfo.get("MATCH_KEY"));
      		}
      		lInserted.add(curRec);
      		if (lInserted.size() == limit) {
      			matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted));
      			iInserted = iInserted + lInserted.size();
      			lInserted.clear();
      		}
      	}
      	if (lInserted.size() > 0) {
      		matchingInnerDelingMapper.insertOriginalData(Map.of("itemList", lInserted));
  			iInserted = iInserted + lInserted.size();    		
      	}
      	log.info("Inserted OrgData : " + iInserted + "건");
      	
      	iDeleted = matchingInnerDelingMapper.deleteData(params);
      	log.debug("Deleted Work Data : " + iDeleted + "건");
      	iInserted = matchingInnerDelingMapper.insertDataFromOriginal(params);
      	log.info("Inserted Work Data : " + iInserted + "건");
      	
      	iDeleted = matchingInnerDelingMapper.deleteDataAi(params);
      	log.debug("Deleted Work AI Data : " + iDeleted + "건");
      	iInserted = matchingInnerDelingMapper.insertDataAiFromOriginal(params);
      	log.info("Inserted Work AI Data : " + iInserted + "건");
      	
      	long endTime = System.currentTimeMillis();
      	log.info("Create Data Ended : " + endTime);
      	log.info("Running Time : " + (endTime - startTime) + "ms");    
      	
      	//작업종료에 대한 로그 업데이트
      	paramLog.put("exit_code", "0");
      	paramLog.put("exit_message", "");    	
      	matchingInnerDelingMapper.finishUserJob(paramLog);
8dc487b1   함상기   Init Version - 20...
459
460
461
462
463
464
      }    
  
      
      
      @SuppressWarnings("rawtypes")
  	@Async("commAsync")
78928007   함상기   20240305
465
      public void returnRwsultData(String jobGroupId, Map<String, String> params) throws Exception {
8dc487b1   함상기   Init Version - 20...
466
467
468
469
470
471
472
473
      	
      	//Job Create Log
      	UUID uuid = UUID.randomUUID();
      	HashMap<String, String> mt = new HashMap<String, String>();
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
          String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
      	
      	Map<String, Object> paramLog = new HashMap<String, Object>();
78928007   함상기   20240305
474
      	paramLog.put("user_job_group", jobGroupId);
8dc487b1   함상기   Init Version - 20...
475
476
477
478
479
480
481
482
      	paramLog.put("user_job_id", sDate);
      	paramLog.put("user_job_name", "결과데이타리턴(" + params.toString() + ")");
      	matchingInnerDelingMapper.createUserJob(paramLog);
      	
      	long startTime = System.currentTimeMillis();
      	log.info("Update Data Started : " + startTime);
      	log.debug("params=" + params.toString());
  
78928007   함상기   20240305
483
484
485
486
      	//기존데이타 초기화
  		int iUpdated = matchingInnerDelingMapper.updateClearNewMatchKey(params);
      	//새로운 매칭키 생성
  		iUpdated = matchingInnerDelingMapper.updateNewMatchKey(params);
8dc487b1   함상기   Init Version - 20...
487
488
489
490
491
492
493
494
495
496
497
498
499
      	log.debug("Updated OrgData : " + iUpdated + "건");
  
      	long endTime = System.currentTimeMillis();
      	log.info("Update Data Ended : " + endTime);
      	log.info("Running Time : " + (endTime - startTime) + "ms");    	
      	
      	
      	//작업종료에 대한 로그 업데이트
      	paramLog.put("exit_code", "0");
      	paramLog.put("exit_message", "");    	
      	matchingInnerDelingMapper.finishUserJob(paramLog);
      	
      }      
a45ecedc   ggun12   * EX 매칭은 순차 실행으로 처리
500
501
  
  
8dc487b1   함상기   Init Version - 20...
502
  }