Commit 789280078d903a9ec4a1687ee2d573a17da95ae9

Authored by 함상기
1 parent 13972027

20240305

src/main/java/com/batch/config/AsyncConfig.java
... ... @@ -2,6 +2,7 @@ package com.batch.config;
2 2  
3 3 import java.util.concurrent.Executor;
4 4  
  5 +import org.springframework.beans.factory.annotation.Value;
5 6 import org.springframework.context.annotation.Bean;
6 7 import org.springframework.context.annotation.Configuration;
7 8 import org.springframework.scheduling.annotation.EnableAsync;
... ... @@ -10,13 +11,22 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
10 11 @Configuration
11 12 @EnableAsync
12 13 public class AsyncConfig {
  14 +
  15 + @Value("${thread.comm.count}")
  16 + Integer iCommAsyncThreadCount;
  17 + @Value("${thread.ext.count}")
  18 + Integer iExtAsyncThreadCount;
  19 + @Value("${thread.ai.count}")
  20 + Integer iAiAsyncThreadCount;
  21 +
13 22  
14 23 @Bean(name = "commAsync")
15 24 public Executor commAsyncExecutor() {
16 25 ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
17   - executor.setCorePoolSize(5);
18   - executor.setMaxPoolSize(50);
19   - executor.setKeepAliveSeconds(30);
  26 + executor.setCorePoolSize(iCommAsyncThreadCount);
  27 + executor.setMaxPoolSize(iCommAsyncThreadCount);
  28 + executor.setQueueCapacity(1000);
  29 + executor.setKeepAliveSeconds(15);
20 30 executor.setAllowCoreThreadTimeOut(true);
21 31 executor.setWaitForTasksToCompleteOnShutdown(true);
22 32 executor.setThreadNamePrefix("commAsync-processor-");
... ... @@ -25,13 +35,28 @@ public class AsyncConfig {
25 35 return executor;
26 36 }
27 37  
  38 + @Bean(name = "extAsync")
  39 + public Executor extAsyncExecutor() {
  40 + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
  41 + executor.setCorePoolSize(iExtAsyncThreadCount);
  42 + executor.setMaxPoolSize(iExtAsyncThreadCount);
  43 + executor.setQueueCapacity(1000);
  44 + executor.setKeepAliveSeconds(15);
  45 + executor.setAllowCoreThreadTimeOut(true);
  46 + executor.setWaitForTasksToCompleteOnShutdown(true);
  47 + executor.setThreadNamePrefix("extAsync-processor-");
  48 + executor.initialize();
  49 +
  50 + return executor;
  51 + }
  52 +
28 53 @Bean(name = "aiAsync")
29 54 public Executor aiAsyncExecutor() {
30 55 ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
31   - executor.setCorePoolSize(50);
32   - executor.setMaxPoolSize(100);
  56 + executor.setCorePoolSize(iAiAsyncThreadCount);
  57 + executor.setMaxPoolSize(iAiAsyncThreadCount);
33 58 executor.setQueueCapacity(1000);
34   - executor.setKeepAliveSeconds(30);
  59 + executor.setKeepAliveSeconds(15);
35 60 executor.setAllowCoreThreadTimeOut(true);
36 61 executor.setWaitForTasksToCompleteOnShutdown(true);
37 62 executor.setThreadNamePrefix("aiAsync-processor-");
... ...
src/main/java/com/batch/config/MatchingExtraProcessorAuto.java
... ... @@ -42,11 +42,13 @@ public class MatchingExtraProcessorAuto {
42 42 String sAccnutYm = (String) paramRec.get("accnut_ym");
43 43 String sCprCode = (String) paramRec.get("cpr_code");
44 44 String sPartCpr = (String) paramRec.get("partn_cpr");
  45 + String sConds = (String) paramRec.get("conds");
45 46  
46 47 //작업시작
47 48 Map<String, Object> mParam = new HashMap<String, Object>();
48 49 mParam.put("sysSe", sSysSe);
49 50 mParam.put("accnutYm", sAccnutYm);
  51 + mParam.put("conds", sConds);
50 52  
51 53 //----------------------------------------------------------------------------
52 54 //자기법인 데이타 가져오기
... ...
src/main/java/com/batch/controller/JobController.java
... ... @@ -4,9 +4,11 @@ import java.util.ArrayList;
4 4 import java.util.HashMap;
5 5 import java.util.List;
6 6 import java.util.Map;
  7 +import java.util.UUID;
7 8  
8 9 import org.springframework.beans.factory.annotation.Autowired;
9 10 import org.springframework.web.bind.annotation.GetMapping;
  11 +import org.springframework.web.bind.annotation.PathVariable;
10 12 import org.springframework.web.bind.annotation.PostMapping;
11 13 import org.springframework.web.bind.annotation.RequestBody;
12 14 import org.springframework.web.bind.annotation.RequestMapping;
... ... @@ -20,6 +22,7 @@ import com.batch.service.JobService;
20 22 import com.batch.util.FileUtil;
21 23 import com.google.gson.JsonObject;
22 24  
  25 +import com.batch.controller.JobController;
23 26 import lombok.extern.slf4j.Slf4j;
24 27  
25 28 @RestController
... ... @@ -34,49 +37,69 @@ public class JobController {
34 37  
35 38  
36 39 @PostMapping("/create")
37   - public String createJob( @RequestBody Map<String, String> params) throws Exception {
  40 + public Map<String, String> createJob( @RequestBody Map<String, String> params) throws Exception {
38 41  
39 42 /*
40 43 * {
41 44 * "sysSe": "LS_ALL",
42 45 * "accnutYm": "202306",
43 46 * }
44   - */
  47 + */
  48 + //Job Create Log
  49 + UUID uuid = UUID.randomUUID();
  50 + String sJobGroup = uuid.toString();
  51 +
45 52 log.debug("Start Create Job");
46   - jobService.createData(params);
  53 + jobService.createData(sJobGroup, params);
47 54 log.debug("End Create Job");
48 55  
  56 + Map<String, String> rtnMap = new HashMap<String, String>();
  57 + rtnMap.put("jobGroupId", sJobGroup);
  58 + rtnMap.put("jobMessage", "신규 작업데이타를 생성합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.");
49 59  
50   - return "신규 작업데이타를 생성합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.";
  60 + return rtnMap;
51 61 }
52 62  
53 63  
54 64 @PostMapping("/matching")
55   - public String matchingJob( @RequestBody Map<String, String> params) throws Exception {
  65 + public Map<String, String> matchingJob( @RequestBody Map<String, String> params) throws Exception {
56 66  
57 67 /*
58 68 * {
59 69 * "sysSe": "LS_ALL",
60 70 * "accnutYm": "202306",
61 71 * }
62   - */
  72 + */
  73 + //Job Create Log
  74 + UUID uuid = UUID.randomUUID();
  75 + String sJobGroup = uuid.toString();
  76 +
63 77 log.debug("Start Matching Job");
64   - jobService.matchingJob(params);
  78 + jobService.matchingJob(sJobGroup, params);
65 79 log.debug("End Matching Job");
66 80  
67   -
68   - return "매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.";
  81 + Map<String, String> rtnMap = new HashMap<String, String>();
  82 + rtnMap.put("jobGroupId", sJobGroup);
  83 + rtnMap.put("jobMessage", "매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.");
  84 +
  85 + return rtnMap;
69 86 }
70 87  
71 88 @PostMapping("/extramatching")
72   - public String extraMatchingJob( @RequestBody Map<String, String> params) throws Exception {
  89 + public Map<String, String> extraMatchingJob( @RequestBody Map<String, String> params) throws Exception {
73 90  
74 91 /*
75 92 * {
76 93 * "sysSe": "LS_ALL",
77   - * "accnutYm": "202306",
  94 + * "accnutYm": "202306",
  95 + * "searchOne": "dta_ty in ('11','21','31','33','35','37','41')",
  96 + * "searchTwo": "dta_ty in ('11','21','31','33','35','37','41')"
78 97 * }
79   - */
  98 + */
  99 + //Job Create Log
  100 + UUID uuid = UUID.randomUUID();
  101 + String sJobGroup = uuid.toString();
  102 +
80 103 log.debug("Start Extra Matching Job");
81 104 List<Map> retData = matchingInnerDelingMapper.getCustomItemReadData(params);
82 105 // List<Map> retData = new ArrayList<Map>();
... ... @@ -84,53 +107,79 @@ public class JobController {
84 107 // m.put("sys_se", "LS_ALL");
85 108 // m.put("accnut_ym", "202311");
86 109 // m.put("cpr_code", "A15300");
87   -// m.put("partn_cpr", "A01100");
  110 +// m.put("partn_cpr", "A01100");
  111 +// m.put("searchOne", "dta_ty in ('11','21','41')");
  112 +// m.put("searchTwo", "dta_ty in ('12','22','42')");
88 113 // retData.add(m);
  114 + // 수익/비용
  115 + for(Map curMap : retData) {
  116 + curMap.put("conds", "T");
  117 + jobService.extraJobSub(sJobGroup, curMap);
  118 + }
  119 + //채권/채무
89 120 for(Map curMap : retData) {
90   - jobService.extraJobSub(curMap);
  121 + curMap.put("conds", "B");
  122 + jobService.extraJobSub(sJobGroup, curMap);
91 123 }
  124 +
92 125 log.debug("End Extra Matching Job");
93 126  
  127 + Map<String, String> rtnMap = new HashMap<String, String>();
  128 + rtnMap.put("jobGroupId", sJobGroup);
  129 + rtnMap.put("jobMessage", "Extra 매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.");
94 130  
95   - return "Extra 매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.";
  131 + return rtnMap;
96 132 }
97 133  
98 134  
99 135 @PostMapping("/aimatching")
100   - public String aiMatchingJob( @RequestBody Map<String, String> params) throws Exception {
  136 + public Map<String, String> aiMatchingJob( @RequestBody Map<String, String> params) throws Exception {
101 137  
102 138 /*
103 139 * {
104 140 * "sysSe": "LS_ALL",
105 141 * "accnutYm": "202306",
106 142 * }
107   - */
  143 + */
  144 + //Job Create Log
  145 + UUID uuid = UUID.randomUUID();
  146 + String sJobGroup = uuid.toString();
  147 +
108 148 log.debug("Start AI Matching Job");
109 149 List<Map> retData = matchingInnerDelingMapper.getAiReadData(params);
110 150 for(Map curMap : retData) {
111   - jobService.aiJobSub(curMap);
  151 + jobService.aiJobSub(sJobGroup, curMap);
112 152 }
113 153 log.debug("End AI Matching Job");
114 154  
  155 + Map<String, String> rtnMap = new HashMap<String, String>();
  156 + rtnMap.put("jobGroupId", sJobGroup);
  157 + rtnMap.put("jobMessage", "AI 매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.");
115 158  
116   - return "AI 매칭작업을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.";
  159 + return rtnMap;
117 160 }
118 161  
119 162 @PostMapping("/return")
120   - public String returnJob( @RequestBody Map<String, String> params) throws Exception {
  163 + public Map<String, String> returnJob( @RequestBody Map<String, String> params) throws Exception {
121 164  
122 165 /*
123 166 * {
124 167 * "sysSe": "LS_ALL",
125 168 * "accnutYm": "202306",
126 169 * }
127   - */
  170 + */
  171 + UUID uuid = UUID.randomUUID();
  172 + String sJobGroup = uuid.toString();
  173 +
128 174 log.debug("Start Return Job");
129   - jobService.returnRwsultData(params);
  175 + jobService.returnRwsultData(sJobGroup, params);
130 176 log.debug("End Return Job");
131 177  
  178 + Map<String, String> rtnMap = new HashMap<String, String>();
  179 + rtnMap.put("jobGroupId", sJobGroup);
  180 + rtnMap.put("jobMessage", "매칭결과 반영을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.");
132 181  
133   - return "매칭결과 반영을 시작합니다. 작업이 끝난후 작업결과는 별도로 확인 바랍니다.";
  182 + return rtnMap;
134 183 }
135 184  
136 185  
... ... @@ -179,5 +228,27 @@ public class JobController {
179 228 return lJobList;
180 229 }
181 230  
  231 + @GetMapping("/userJobInfo/{userJobGroup}")
  232 + public Object statusBatchJob(@PathVariable(name = "userJobGroup") String sUserJobGroup) throws Exception {
  233 + Map<String, Object> rtnVal = new HashMap<String, Object>();
  234 +
  235 + Map<String, Object> mParam = new HashMap<String, Object>();
  236 + mParam.put("userJobGroup", sUserJobGroup);
  237 + List<Map> lmJob = matchingInnerDelingMapper.getUserJobStatus(mParam);
  238 + rtnVal.put("JobList", lmJob);
  239 + boolean blnStatus = true;
  240 + for (Map curMap : lmJob) {
  241 + String ScurStatus = (String) curMap.get("status");
  242 + if (!"Finished".equalsIgnoreCase(ScurStatus)) {
  243 + blnStatus = false;
  244 + break;
  245 + }
  246 + }
  247 + rtnVal.put("JobStatus", blnStatus);
  248 +
  249 +
  250 + return rtnVal;
  251 + }
  252 +
182 253  
183 254 }
... ...
src/main/java/com/batch/mapper/primary/MatchingInnerDelingMapper.java
... ... @@ -100,6 +100,14 @@ public interface MatchingInnerDelingMapper {
100 100 */
101 101 @SuppressWarnings("rawtypes")
102 102 int insertDataAiFromOriginal(Map param);
  103 +
  104 + /**
  105 + * 새로운 일치키 생성전 초기화
  106 + * @param param
  107 + * @return
  108 + */
  109 + @SuppressWarnings("rawtypes")
  110 + int updateClearNewMatchKey(Map param);
103 111  
104 112 /**
105 113 * 값을 돌려주기전 월별 새로운 일치키 생성
... ... @@ -154,5 +162,11 @@ public interface MatchingInnerDelingMapper {
154 162 */
155 163 @SuppressWarnings("rawtypes")
156 164 List<Map> getAiReadData(Map param);
  165 +
  166 + /*
  167 + * User Job Status
  168 + */
  169 + @SuppressWarnings("rawtypes")
  170 + List<Map> getUserJobStatus(Map param);
157 171  
158 172 }
159 173 \ No newline at end of file
... ...
src/main/java/com/batch/service/JobService.java
... ... @@ -34,6 +34,7 @@ import com.batch.mapper.primary.MatchingInnerDelingMapper;
34 34 import com.batch.mapper.secondary.OracleMapper;
35 35 import com.batch.util.FileUtil;
36 36  
  37 +import com.batch.service.JobService;
37 38 import lombok.extern.slf4j.Slf4j;
38 39  
39 40 @Slf4j
... ... @@ -61,11 +62,24 @@ public class JobService {
61 62  
62 63 @SuppressWarnings("rawtypes")
63 64 @Async("commAsync")
64   - public void matchingJob( Map<String, String> params) throws Exception {
  65 + public void matchingJob(String jobGroupId, Map<String, String> params) throws Exception {
65 66  
  67 + //Job Create Log
  68 + UUID uuid = UUID.randomUUID();
  69 + HashMap<String, String> mt = new HashMap<String, String>();
  70 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
  71 + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
  72 +
  73 + Map<String, Object> paramLog = new HashMap<String, Object>();
  74 + paramLog.put("user_job_group", jobGroupId);
  75 + paramLog.put("user_job_id", sDate);
  76 + paramLog.put("user_job_name", "자동매칭(" + params.toString() + ")");
  77 + matchingInnerDelingMapper.createUserJob(paramLog);
  78 +
  79 + String sThreadName = Thread.currentThread().getName();
66 80 long startTime = System.currentTimeMillis();
67   - log.info("Job Started : " + startTime);
68   - log.debug("params=" + params.toString());
  81 + log.info("[" + sThreadName + "]Job Started : " + startTime);
  82 + log.debug("[" + sThreadName + "]params=" + params.toString());
69 83  
70 84 StringBuffer sb = FileUtil.readFileToString("matchingSetup.json");
71 85 MatchingSetup matchingSetup = (MatchingSetup) FileUtil.strToObj(sb.toString(), MatchingSetup.class);
... ... @@ -80,14 +94,14 @@ public class JobService {
80 94 if (matching.getActive()) {
81 95 lJobType.add(matching.getType());
82 96 } else {
83   - log.info("JobType(" + matching.getType() + ") is Disabled");
  97 + log.info("[" + sThreadName + "]JobType(" + matching.getType() + ") is Disabled");
84 98 }
85 99 }
86 100 }
87 101  
88 102  
89 103 for (String sJobType : lJobType) {
90   - log.info("Current running job type: " + sJobType);
  104 + log.info("[" + sThreadName + "]Current running job type: " + sJobType);
91 105 JobExecution jobExe = invokeJob("matchingInnerDelng", sJobType, params);
92 106 if (!jobExe.getStatus().equals(BatchStatus.COMPLETED)) {
93 107 throw new Exception("Job execution error : Batchstatus(" + jobExe.getStatus() + "), ExitStatus(" + jobExe.getExitStatus() + ")" );
... ... @@ -95,20 +109,38 @@ public class JobService {
95 109 }
96 110  
97 111 long endTime = System.currentTimeMillis();
98   - log.info("Job Type : " + lJobType.toString());
99   - log.info("Job Ended: " + endTime);
100   - log.info("Running Time : " + (endTime - startTime) + "ms");
  112 + log.info("[" + sThreadName + "]Job Type : " + lJobType.toString());
  113 + log.info("[" + sThreadName + "]Job Ended: " + endTime);
  114 + log.info("[" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
101 115  
  116 + //작업종료에 대한 로그 업데이트
  117 + paramLog.put("exit_code", "0");
  118 + paramLog.put("exit_message", "");
  119 + matchingInnerDelingMapper.finishUserJob(paramLog);
  120 +
102 121 }
103 122  
104 123  
105 124 @SuppressWarnings("rawtypes")
106   - @Async("aiAsync")
107   - public void extraJobSub(Map paramRec) throws Exception {
  125 + @Async("extAsync")
  126 + public void extraJobSub(String jobGroupId, Map paramRec) throws Exception {
  127 +
  128 + //Job Create Log
  129 + UUID uuid = UUID.randomUUID();
  130 + HashMap<String, String> mt = new HashMap<String, String>();
  131 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-hh-mm-ss");
  132 + String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
  133 +
  134 + Map<String, Object> paramLog = new HashMap<String, Object>();
  135 + paramLog.put("user_job_group", jobGroupId);
  136 + paramLog.put("user_job_id", sDate);
  137 + paramLog.put("user_job_name", "Extra매칭(" + paramRec.toString() + ")");
  138 + matchingInnerDelingMapper.createUserJob(paramLog);
108 139  
  140 + String sThreadName = Thread.currentThread().getName();
109 141 long startTime = System.currentTimeMillis();
110   - log.info("Job Started : " + startTime);
111   - log.debug("params=" + paramRec.toString());
  142 + log.info("[" + sThreadName + "]Job Started : " + startTime);
  143 + log.debug("[" + sThreadName + "]params=" + paramRec.toString());
112 144  
113 145 MatchingExtraProcessorAuto matchingExtraProcessorAuto = new MatchingExtraProcessorAuto(matchingInnerDelingMapper);
114 146  
... ... @@ -124,30 +156,27 @@ public class JobService {
124 156 }
125 157  
126 158 //3건씩 매칭일 경우 최대 5000건 까지
127   - for (int i=0; i<5000;i=i+50) {
  159 + for (int i=0; i<2000;i=i+100) {
128 160 matchingExtraProcessorAuto.process(paramRec, 1, 3, 0, i);
129 161 }
130   - for (int i=0; i<5000;i=i+50) {
  162 + for (int i=0; i<2000;i=i+100) {
131 163 matchingExtraProcessorAuto.process(paramRec, 3, 1, i, 0);
132 164 }
133   -
134   - //3건씩 매칭일 경우 최대 2000건 까지
135   - for (int i=0; i<2000;i=i+25) {
136   - matchingExtraProcessorAuto.process(paramRec, 1, 4, 0, i);
137   - }
138   - for (int i=0; i<2000;i=i+25) {
139   - matchingExtraProcessorAuto.process(paramRec, 4, 1, i, 0);
140   - }
141 165  
142 166 long endTime = System.currentTimeMillis();
143   - log.info("Job Ended: " + endTime);
144   - log.info("Running Time : " + (endTime - startTime) + "ms");
  167 + log.info("[" + sThreadName + "]Job Ended: " + endTime);
  168 + log.info("[" + sThreadName + "]Running Time : " + (endTime - startTime) + "ms");
145 169  
  170 + //작업종료에 대한 로그 업데이트
  171 + paramLog.put("exit_code", "0");
  172 + paramLog.put("exit_message", "");
  173 + matchingInnerDelingMapper.finishUserJob(paramLog);
  174 +
146 175 }
147 176  
148 177 @SuppressWarnings("rawtypes")
149 178 @Async("aiAsync")
150   - public void aiJobSub(Map paramRec) throws Exception {
  179 + public void aiJobSub(String jobGroupId, Map paramRec) throws Exception {
151 180  
152 181  
153 182 //Job Create Log
... ... @@ -157,6 +186,7 @@ public class JobService {
157 186 String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
158 187  
159 188 Map<String, Object> paramLog = new HashMap<String, Object>();
  189 + paramLog.put("user_job_group", jobGroupId);
160 190 paramLog.put("user_job_id", sDate);
161 191 paramLog.put("user_job_name", "AI매칭(" + paramRec.toString() + ")");
162 192 matchingInnerDelingMapper.createUserJob(paramLog);
... ... @@ -171,10 +201,12 @@ public class JobService {
171 201 String sCprCode = (String) paramRec.get("cpr_code");
172 202 String sPartCpr = (String) paramRec.get("partn_cpr");
173 203 String sDelngCrncy = (String) paramRec.get("delng_crncy");
174   -
  204 +
  205 + String sThreadName = Thread.currentThread().getName();
  206 +
175 207 log.debug("call python");
176 208 new ProcessExecutor()
177   - .command(sPythonPrg, sPythonAiTarget, sSysSe, sAccnutYm, sCprCode, sPartCpr, sDelngCrncy)
  209 + .command(sPythonPrg, sPythonAiTarget, sThreadName, sSysSe, sAccnutYm, sCprCode, sPartCpr, sDelngCrncy)
178 210 .redirectOutput(new LogOutputStream() {
179 211 @Override
180 212 protected void processLine(String line) {
... ... @@ -194,7 +226,6 @@ public class JobService {
194 226 matchingInnerDelingMapper.finishUserJob(paramLog);
195 227  
196 228 }
197   -
198 229  
199 230  
200 231 public JobExecution invokeJob(String jobName, String jobType, Map<String, String> params) throws JobInstanceAlreadyCompleteException, JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
... ... @@ -221,7 +252,7 @@ public class JobService {
221 252  
222 253 @SuppressWarnings("rawtypes")
223 254 @Async("commAsync")
224   - public void createData( Map<String, String> params) throws Exception {
  255 + public void createData(String jobGroupId, Map<String, String> params) throws Exception {
225 256  
226 257 //Job Create Log
227 258 UUID uuid = UUID.randomUUID();
... ... @@ -230,6 +261,7 @@ public class JobService {
230 261 String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
231 262  
232 263 Map<String, Object> paramLog = new HashMap<String, Object>();
  264 + paramLog.put("user_job_group", jobGroupId);
233 265 paramLog.put("user_job_id", sDate);
234 266 paramLog.put("user_job_name", "작업데이타생성(" + params.toString() + ")");
235 267 matchingInnerDelingMapper.createUserJob(paramLog);
... ... @@ -294,14 +326,13 @@ public class JobService {
294 326 paramLog.put("exit_code", "0");
295 327 paramLog.put("exit_message", "");
296 328 matchingInnerDelingMapper.finishUserJob(paramLog);
297   -
298 329 }
299 330  
300 331  
301 332  
302 333 @SuppressWarnings("rawtypes")
303 334 @Async("commAsync")
304   - public void returnRwsultData( Map<String, String> params) throws Exception {
  335 + public void returnRwsultData(String jobGroupId, Map<String, String> params) throws Exception {
305 336  
306 337 //Job Create Log
307 338 UUID uuid = UUID.randomUUID();
... ... @@ -310,6 +341,7 @@ public class JobService {
310 341 String sDate = dateFormat.format(new Date()) + ":" + uuid.toString();
311 342  
312 343 Map<String, Object> paramLog = new HashMap<String, Object>();
  344 + paramLog.put("user_job_group", jobGroupId);
313 345 paramLog.put("user_job_id", sDate);
314 346 paramLog.put("user_job_name", "결과데이타리턴(" + params.toString() + ")");
315 347 matchingInnerDelingMapper.createUserJob(paramLog);
... ... @@ -318,8 +350,10 @@ public class JobService {
318 350 log.info("Update Data Started : " + startTime);
319 351 log.debug("params=" + params.toString());
320 352  
321   - //기존데이타 삭제
322   - int iUpdated = matchingInnerDelingMapper.updateNewMatchKey(params);
  353 + //기존데이타 초기화
  354 + int iUpdated = matchingInnerDelingMapper.updateClearNewMatchKey(params);
  355 + //새로운 매칭키 생성
  356 + iUpdated = matchingInnerDelingMapper.updateNewMatchKey(params);
323 357 log.debug("Updated OrgData : " + iUpdated + "건");
324 358  
325 359 long endTime = System.currentTimeMillis();
... ...
src/main/resources/application.properties
... ... @@ -48,6 +48,11 @@ logging.level.root=info
48 48 logging.level.com.batch=info
49 49 logging.level.p6spy=off
50 50  
  51 +#Thread Count 설정
  52 +thread.comm.count=10
  53 +thread.ext.count=50
  54 +thread.ai.count=50
  55 +
51 56 #Python 프로퍼티 설정
52 57 pytyon.path=D:\\Programs\\devp\\python-3.12.2\\python.exe
53 58 python.ai.target=D:\\Working\\Python\\Test1.py
54 59 \ No newline at end of file
... ...
src/main/resources/mybatis/primaryMapper/MatchingInnerDelingMapper.xml
... ... @@ -361,6 +361,16 @@
361 361 cons_group = #{sysSe}
362 362 and account_period = #{accnutYm}
363 363 </update>
  364 +
  365 + <update id="updateClearNewMatchKey" parameterType="map">
  366 + update batch_tbcr_inner_delng
  367 + set
  368 + new_mtch_ty = null,
  369 + new_mtch_ky = null
  370 + where
  371 + sys_se = #{sysSe}
  372 + AND accnut_ym = #{accnutYm}
  373 + </update>
364 374  
365 375 <update id="updateNewMatchKey" parameterType="map">
366 376 merge into batch_tbcr_inner_delng m
... ... @@ -410,7 +420,12 @@
410 420 and cpr_code = #{cprCode}
411 421 and partn_cpr = #{partnCpr}
412 422 and mtch_ky is null
413   - and dta_ty in ('11','21','31','33','35','37','41')
  423 + <if test='conds eq "T".toString()'>
  424 + and dta_ty in ('11','21','41')
  425 + </if>
  426 + <if test='conds eq "B".toString()'>
  427 + and dta_ty in ('31','33','35','37')
  428 + </if>
414 429 and delng_amt != 0
415 430 ORDER BY
416 431 delng_de
... ... @@ -433,7 +448,12 @@
433 448 and cpr_code = #{cprCode}
434 449 and partn_cpr = #{partnCpr}
435 450 and mtch_ky is null
436   - and dta_ty in ('12','22','32','34','36','38','42')
  451 + <if test='conds eq "T".toString()'>
  452 + and dta_ty in ('12','22','42')
  453 + </if>
  454 + <if test='conds eq "B".toString()'>
  455 + and dta_ty in ('32','34','36','38')
  456 + </if>
437 457 and delng_amt != 0
438 458 ORDER BY
439 459 delng_de
... ... @@ -456,11 +476,13 @@
456 476  
457 477 <update id="createUserJob" parameterType="map">
458 478 INSERT INTO public.batch_user_job_status (
  479 + user_job_group,
459 480 user_job_id,
460 481 user_job_name,
461 482 start_time,
462 483 status
463 484 ) VALUES (
  485 + #{user_job_group},
464 486 #{user_job_id},
465 487 #{user_job_name},
466 488 now(),
... ... @@ -538,5 +560,68 @@
538 560 , partn_cpr
539 561 , delng_crncy
540 562 HAVING sum(cnt) > 1
541   - </select>
  563 + </select>
  564 +
  565 + <!-- User Job Status -->
  566 + <select id="getUserJobStatus" parameterType="map" resultType="map">
  567 + SELECT
  568 + user_job_id
  569 + , user_job_name
  570 + , start_time
  571 + , end_time
  572 + , status
  573 + , exit_code
  574 + , exit_message
  575 + , user_job_group
  576 + FROM
  577 + public.batch_user_job_status
  578 + WHERE
  579 + user_job_group = #{userJobGroup}
  580 + ORDER BY
  581 + user_job_id ASC
  582 + </select>
  583 +
  584 + <!-- ReturnData Select -->
  585 + <select id="getReturnData" parameterType="map" resultType="map">
  586 + SELECT
  587 + sys_se
  588 + , accnut_ym
  589 + , sn
  590 + , dta_ty
  591 + , cpr_code
  592 + , partn_cpr
  593 + , cpr_acnt_code
  594 + , cnnc_acnt_code
  595 + , cnnc_acnt_nm
  596 + , delng_de
  597 + , elcty_de
  598 + , chit_no
  599 + , cmpnsp_ky
  600 + , ext_key1
  601 + , ext_key2
  602 + , ext_key3
  603 + , ext_key4
  604 + , ext_key5
  605 + , delng_crncy
  606 + , delng_amt
  607 + , acntbk_amt
  608 + , group_amt
  609 + , suply_amount
  610 + , sumry
  611 + , org_mtch_ty
  612 + , org_mtch_ky
  613 + , new_mtch_ty
  614 + , new_mtch_ky
  615 + , compare_ky
  616 + , mtch_sys
  617 + , mtch_ty
  618 + , mtch_ty_nm
  619 + , mtch_ky
  620 + FROM
  621 + batch_tbcr_inner_delng
  622 + WHERE
  623 + sys_se = #{sysSe}
  624 + and accnut_ym = #{accnutYm}
  625 + </select>
  626 +
542 627 </mapper>
543 628 \ No newline at end of file
... ...