|
@@ -2,6 +2,7 @@ package com.ggits.etlp.server.service;
|
|
|
|
|
|
import com.ggits.etlp.server.common.Elapsed;
|
|
|
import com.ggits.etlp.server.common.TimeUtils;
|
|
|
+import com.ggits.etlp.server.config.ApplicationConfig;
|
|
|
import com.ggits.etlp.server.dao.mapper.BatchDaoService;
|
|
|
import com.ggits.etlp.server.dao.mapper.ggits.GgitsMapper;
|
|
|
import com.ggits.etlp.server.dao.mapper.sig.SigMapper;
|
|
@@ -9,8 +10,10 @@ import com.ggits.etlp.server.dao.mapper.sig.batch.SigDao;
|
|
|
import com.ggits.etlp.server.dto.EtlpInfo;
|
|
|
import com.ggits.etlp.server.dto.RegionCenter;
|
|
|
import com.ggits.etlp.server.entity.ggits.*;
|
|
|
+import com.ggits.etlp.server.entity.sig.TbGgitsEtlp;
|
|
|
import com.ggits.etlp.server.entity.sig.TbInt;
|
|
|
import com.ggits.etlp.server.repository.ApplicationRepository;
|
|
|
+import com.ggits.etlp.server.repository.EtlpConst;
|
|
|
import lombok.Getter;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -32,11 +35,21 @@ import java.util.List;
|
|
|
@Transactional(rollbackFor = {Exception.class})
|
|
|
public class GgitsEtlpService {
|
|
|
|
|
|
+ private final ApplicationConfig config;
|
|
|
private final ApplicationRepository repo;
|
|
|
private final GgitsMapper gitsMapper;
|
|
|
private final SigMapper sigMapper;
|
|
|
private final SigDao dao;
|
|
|
- private final int MAX_PAGE_COUNT = 50000;
|
|
|
+
|
|
|
+ private final String[] etlpTables = {
|
|
|
+ EtlpConst.etlpTableInt,
|
|
|
+ EtlpConst.etlpTableFlow,
|
|
|
+ EtlpConst.etlpTableOperPlan,
|
|
|
+ EtlpConst.etlpTableDyPlan,
|
|
|
+ EtlpConst.etlpTableResrvPlan,
|
|
|
+ EtlpConst.etlpTableSignalMap
|
|
|
+ };
|
|
|
+
|
|
|
private List<String> centerList;
|
|
|
|
|
|
@PostConstruct
|
|
@@ -61,6 +74,17 @@ public class GgitsEtlpService {
|
|
|
continue;
|
|
|
}
|
|
|
center.setElapsed(0);
|
|
|
+ center.initEtlp();
|
|
|
+ }
|
|
|
+
|
|
|
+ for (String etlpTblNm : this.etlpTables) {
|
|
|
+ List<TbGgitsEtlp> etlpList = this.sigMapper.selectGgitsEtlp(etlpTblNm);
|
|
|
+ for (TbGgitsEtlp obj : etlpList) {
|
|
|
+ RegionCenter center = this.repo.getCenterMap().get(obj.getRegionCd());
|
|
|
+ if (center != null) {
|
|
|
+ center.updateEtlp(etlpTblNm, obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -74,30 +98,47 @@ public class GgitsEtlpService {
|
|
|
//교차로구성_연계, SCS_T_CON_INTLC
|
|
|
etlpIntLc();
|
|
|
|
|
|
- //교차로이동류_연계, SCS_T_CON_INTFLOW
|
|
|
- etlpIntFlow();
|
|
|
-
|
|
|
- //교차로일계획_연계, SCS_T_CON_INTDPLAN
|
|
|
- etlpIntDPlan();
|
|
|
-
|
|
|
- //교차로주간계획_연계, SCS_T_CON_INTWEEK
|
|
|
- etlpIntWeek();
|
|
|
-
|
|
|
- //교차로예약계획_연계, SCS_T_CON_INTFPLAN
|
|
|
- etlpIntFPlan();
|
|
|
-
|
|
|
- //교차로시그널맵_연계, SCS_T_CON_INTSIGMAP
|
|
|
- etlpIntSigmap();
|
|
|
+// //교차로이동류_연계, SCS_T_CON_INTFLOW
|
|
|
+// etlpIntFlow();
|
|
|
+//
|
|
|
+// //교차로일계획_연계, SCS_T_CON_INTDPLAN
|
|
|
+// etlpIntDPlan();
|
|
|
+//
|
|
|
+// //교차로주간계획_연계, SCS_T_CON_INTWEEK
|
|
|
+// etlpIntWeek();
|
|
|
+//
|
|
|
+// //교차로예약계획_연계, SCS_T_CON_INTFPLAN
|
|
|
+// etlpIntFPlan();
|
|
|
+//
|
|
|
+// //교차로시그널맵_연계, SCS_T_CON_INTSIGMAP
|
|
|
+// etlpIntSigmap();
|
|
|
|
|
|
log.info("GGITS DBASE ETLP TO SIG ..END: {}", elapsed.elapsedTimeStr());
|
|
|
log.info("<************************************************************************************************");
|
|
|
}
|
|
|
|
|
|
+ private int getPageCount(int etlpCount) {
|
|
|
+ int pageCount = (etlpCount / this.config.getPageCount()) + 1;
|
|
|
+ if (0 == (etlpCount % this.config.getPageCount())) {
|
|
|
+ pageCount--;
|
|
|
+ }
|
|
|
+ return pageCount;
|
|
|
+ }
|
|
|
+ private void updateEtlpResult(List<HashMap<String, Object>> etlpLists) {
|
|
|
+ try {
|
|
|
+ this.dao.updateGgitsEtlp(etlpLists);
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ log.error("updateEtlpResult: {}, Exceptions: {}", etlpLists, e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//교차로구성_연계, SCS_T_CON_INTLC
|
|
|
private void etlpIntLc() {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT, SCS_T_CON_INTLC START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -110,59 +151,63 @@ public class GgitsEtlpService {
|
|
|
int writeCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
EtlpInfo etlp = center.getEtlpIntLc();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("================================================================================================>");
|
|
|
log.info("TB_INT, SCS_T_CON_INTLC START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- this.sigMapper.initTbInt(center.getRegionCd());
|
|
|
+// this.sigMapper.initTbInt(center.getRegionCd());
|
|
|
HashMap<Integer, TbInt> intMap = new HashMap<>();
|
|
|
List<TbInt> intLists = this.sigMapper.selectTbInt(center.getRegionCd());
|
|
|
for (TbInt intInt : intLists) {
|
|
|
intMap.put(intInt.getIntNo(), intInt);
|
|
|
}
|
|
|
|
|
|
- List<TbScsTConIntLc> jobLists = this.gitsMapper.selectScsTConIntLc(center);
|
|
|
-
|
|
|
- log.info("TB_INT, SCS_T_CON_INTLC .READ. {}, {}, SIG: {} EA, GGITS: {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), intLists.size(), jobLists.size(), job.elapsedTimeStr());
|
|
|
- job.reset();
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntLcCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntLcCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT, SCS_T_CON_INTLC .READ. {}, {}, SIG: {} EA, GGITS: DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), intLists.size(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- center.getEtlpIntLc().setReadCount(jobLists.size());
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ List<TbScsTConIntLc> jobLists = this.gitsMapper.selectScsTConIntLc(center, etlp.getQryDt());
|
|
|
+ log.info("TB_INT, SCS_T_CON_INTLC .READ. {}, {}, SIG: {} EA, GGITS: {} EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), intLists.size(), jobLists.size(), job.elapsedTimeStr());
|
|
|
+ job.reset();
|
|
|
|
|
|
- lists = new ArrayList<>();
|
|
|
- for(TbScsTConIntLc obj: jobLists) {
|
|
|
- if (obj.getIntName() == null || obj.getIntName().isEmpty()) {
|
|
|
- TbInt orgInt = intMap.get(obj.getIntNo());
|
|
|
- if (orgInt != null) {
|
|
|
- obj.setIntName(orgInt.getIntNm());
|
|
|
- }
|
|
|
+ lists = new ArrayList<>();
|
|
|
+ for (TbScsTConIntLc obj : jobLists) {
|
|
|
if (obj.getIntName() == null || obj.getIntName().isEmpty()) {
|
|
|
- obj.setIntName("-");
|
|
|
+ TbInt orgInt = intMap.get(obj.getIntNo());
|
|
|
+ if (orgInt != null) {
|
|
|
+ obj.setIntName(orgInt.getIntNm());
|
|
|
+ }
|
|
|
+ if (obj.getIntName() == null || obj.getIntName().isEmpty()) {
|
|
|
+ obj.setIntName("-");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- HashMap<String, Object> param = obj.toSig(center.getRegionCd());
|
|
|
- lists.add(param);
|
|
|
- if (lists.size() >= BatchDaoService.MAX_BATCH_SIZE) {
|
|
|
+ HashMap<String, Object> param = obj.toSig(center.getRegionCd());
|
|
|
+ lists.add(param);
|
|
|
+ if (lists.size() >= BatchDaoService.MAX_BATCH_SIZE) {
|
|
|
+ writeCount += this.dao.updateTbInt(lists);
|
|
|
+ lists = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!lists.isEmpty()) {
|
|
|
writeCount += this.dao.updateTbInt(lists);
|
|
|
- lists = new ArrayList<>();
|
|
|
}
|
|
|
}
|
|
|
- if (!lists.isEmpty()) {
|
|
|
- writeCount += this.dao.updateTbInt(lists);
|
|
|
- }
|
|
|
- etlp.setWriteCount(writeCount);
|
|
|
- etlp.setSuccess(true);
|
|
|
+ etlp.endEtlp(true, writeCount);
|
|
|
log.info("TB_INT, SCS_T_CON_INTLC WRITE. {}, {}, {} EA. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
|
|
|
log.info("-------------------------------------------------------------------------------------------------");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT, SCS_T_CON_INTLC: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -170,7 +215,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableInt));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT, SCS_T_CON_INTLC ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
|
|
@@ -179,6 +226,7 @@ public class GgitsEtlpService {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -193,29 +241,26 @@ public class GgitsEtlpService {
|
|
|
int currWriteCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
EtlpInfo etlp = center.getEtlpFlow();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- Integer dataCount = this.gitsMapper.selectScsTConIntFlowCount(center);
|
|
|
- etlp.setReadCount(dataCount);
|
|
|
- log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW .READ. {}, {}, {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), dataCount, job.elapsedTimeStr());
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntFlowCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntFlowCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW .READ. {}, {}, DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- if (dataCount > 0) {
|
|
|
- int fromSeq, toSeq;
|
|
|
- int pageCount = (dataCount / MAX_PAGE_COUNT) + 1;
|
|
|
- if (0 == (dataCount % MAX_PAGE_COUNT)) {
|
|
|
- pageCount--;
|
|
|
- }
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ int pageCount = getPageCount(etlpCount);
|
|
|
for (int ii = 0; ii < pageCount; ii++) {
|
|
|
- fromSeq = (ii * MAX_PAGE_COUNT);
|
|
|
- toSeq = fromSeq + MAX_PAGE_COUNT;
|
|
|
+ int fromSeq = (ii * this.config.getPageCount());
|
|
|
+ int toSeq = fromSeq + this.config.getPageCount();
|
|
|
fromSeq++;
|
|
|
- List<TbScsTConIntFlow> result = this.gitsMapper.selectScsTConIntFlow(center, fromSeq, toSeq);
|
|
|
+ List<TbScsTConIntFlow> result = this.gitsMapper.selectScsTConIntFlow(center, fromSeq, toSeq, etlp.getQryDt());
|
|
|
log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW .READ. {}, {}, {}. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, result.size()), job.elapsedTimeStr());
|
|
|
TimeUtils.sleep(500);
|
|
@@ -239,14 +284,13 @@ public class GgitsEtlpService {
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, currWriteCount), job.elapsedTimeStr());
|
|
|
}
|
|
|
}
|
|
|
- etlp.setWriteCount(writeCount);
|
|
|
- etlp.setSuccess(true);
|
|
|
+ etlp.endEtlp(true, writeCount);
|
|
|
log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW WRITE. {}, {}, {} EA. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
|
|
|
log.info("-------------------------------------------------------------------------------------------------");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT_FLOW, SCS_T_CON_INTFLOW: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -254,7 +298,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableFlow));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT_FLOW, SCS_T_CON_INTFLOW ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
|
|
@@ -263,6 +309,7 @@ public class GgitsEtlpService {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -276,30 +323,27 @@ public class GgitsEtlpService {
|
|
|
int writeCount = 0;
|
|
|
int currWriteCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
- EtlpInfo etlp = center.getEtlpDPlan();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ EtlpInfo etlp = center.getEtlpOperPlan();
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- Integer dataCount = this.gitsMapper.selectScsTConIntDPlanCount(center);
|
|
|
- etlp.setReadCount(dataCount);
|
|
|
- log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN .READ. {}, {}, {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), dataCount, job.elapsedTimeStr());
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntDPlanCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntDPlanCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN .READ. {}, {}, DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- if (dataCount > 0) {
|
|
|
- int fromSeq, toSeq;
|
|
|
- int pageCount = (dataCount / MAX_PAGE_COUNT) + 1;
|
|
|
- if (0 == (dataCount % MAX_PAGE_COUNT)) {
|
|
|
- pageCount--;
|
|
|
- }
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ int pageCount = getPageCount(etlpCount);
|
|
|
for (int ii = 0; ii < pageCount; ii++) {
|
|
|
- fromSeq = (ii * MAX_PAGE_COUNT);
|
|
|
- toSeq = fromSeq + MAX_PAGE_COUNT;
|
|
|
+ int fromSeq = (ii * this.config.getPageCount());
|
|
|
+ int toSeq = fromSeq + this.config.getPageCount();
|
|
|
fromSeq++;
|
|
|
- List<TbScsTConIntDPlan> result = this.gitsMapper.selectScsTConIntDPlan(center, fromSeq, toSeq);
|
|
|
+ List<TbScsTConIntDPlan> result = this.gitsMapper.selectScsTConIntDPlan(center, fromSeq, toSeq, etlp.getQryDt());
|
|
|
log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN .READ. {}, {}, {}. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, result.size()), job.elapsedTimeStr());
|
|
|
TimeUtils.sleep(500);
|
|
@@ -323,14 +367,13 @@ public class GgitsEtlpService {
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, currWriteCount), job.elapsedTimeStr());
|
|
|
}
|
|
|
}
|
|
|
- etlp.setWriteCount(writeCount);
|
|
|
- etlp.setSuccess(true);
|
|
|
+ etlp.endEtlp(true, writeCount);
|
|
|
log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN WRITE. {}, {}, {} EA. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
|
|
|
log.info("-------------------------------------------------------------------------------------------------");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -338,7 +381,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableOperPlan));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT_OPER_PLAN, SCS_T_CON_INTDPLAN ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
|
|
@@ -347,6 +392,7 @@ public class GgitsEtlpService {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -360,30 +406,27 @@ public class GgitsEtlpService {
|
|
|
int writeCount = 0;
|
|
|
int currWriteCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
- EtlpInfo etlp = center.getEtlpWeek();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ EtlpInfo etlp = center.getEtlpDyPlan();
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- Integer dataCount = this.gitsMapper.selectScsTConIntWeekCount(center);
|
|
|
- etlp.setReadCount(dataCount);
|
|
|
- log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK .READ. {}, {}, {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), dataCount, job.elapsedTimeStr());
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntWeekCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntWeekCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK .READ. {}, {}, DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- if (dataCount > 0) {
|
|
|
- int fromSeq, toSeq;
|
|
|
- int pageCount = (dataCount / MAX_PAGE_COUNT) + 1;
|
|
|
- if (0 == (dataCount % MAX_PAGE_COUNT)) {
|
|
|
- pageCount--;
|
|
|
- }
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ int pageCount = getPageCount(etlpCount);
|
|
|
for (int ii = 0; ii < pageCount; ii++) {
|
|
|
- fromSeq = (ii * MAX_PAGE_COUNT);
|
|
|
- toSeq = fromSeq + MAX_PAGE_COUNT;
|
|
|
+ int fromSeq = (ii * this.config.getPageCount());
|
|
|
+ int toSeq = fromSeq + this.config.getPageCount();
|
|
|
fromSeq++;
|
|
|
- List<TbScsTConIntWeek> result = this.gitsMapper.selectScsTConIntWeek(center, fromSeq, toSeq);
|
|
|
+ List<TbScsTConIntWeek> result = this.gitsMapper.selectScsTConIntWeek(center, fromSeq, toSeq, etlp.getQryDt());
|
|
|
log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK .READ. {}, {}, {}. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, result.size()), job.elapsedTimeStr());
|
|
|
TimeUtils.sleep(500);
|
|
@@ -407,14 +450,13 @@ public class GgitsEtlpService {
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, currWriteCount), job.elapsedTimeStr());
|
|
|
}
|
|
|
}
|
|
|
- etlp.setWriteCount(writeCount);
|
|
|
- etlp.setSuccess(true);
|
|
|
+ etlp.endEtlp(true, writeCount);
|
|
|
log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK WRITE. {}, {}, {} EA. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
|
|
|
log.info("-------------------------------------------------------------------------------------------------");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -422,7 +464,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableDyPlan));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT_DY_PLAN, SCS_T_CON_INTWEEK ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
|
|
@@ -431,6 +475,7 @@ public class GgitsEtlpService {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -444,30 +489,27 @@ public class GgitsEtlpService {
|
|
|
int writeCount = 0;
|
|
|
int currWriteCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
- EtlpInfo etlp = center.getEtlpFPlan();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ EtlpInfo etlp = center.getEtlpResrvPlan();
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- Integer dataCount = this.gitsMapper.selectScsTConIntFPlanCount(center);
|
|
|
- etlp.setReadCount(dataCount);
|
|
|
- log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN .READ. {}, {}, {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), dataCount, job.elapsedTimeStr());
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntFPlanCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntFPlanCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN .READ. {}, {}, DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- if (dataCount > 0) {
|
|
|
- int fromSeq, toSeq;
|
|
|
- int pageCount = (dataCount / MAX_PAGE_COUNT) + 1;
|
|
|
- if (0 == (dataCount % MAX_PAGE_COUNT)) {
|
|
|
- pageCount--;
|
|
|
- }
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ int pageCount = getPageCount(etlpCount);
|
|
|
for (int ii = 0; ii < pageCount; ii++) {
|
|
|
- fromSeq = (ii * MAX_PAGE_COUNT);
|
|
|
- toSeq = fromSeq + MAX_PAGE_COUNT;
|
|
|
+ int fromSeq = (ii * this.config.getPageCount());
|
|
|
+ int toSeq = fromSeq + this.config.getPageCount();
|
|
|
fromSeq++;
|
|
|
- List<TbScsTConIntFPlan> result = this.gitsMapper.selectScsTConIntFPlan(center, fromSeq, toSeq);
|
|
|
+ List<TbScsTConIntFPlan> result = this.gitsMapper.selectScsTConIntFPlan(center, fromSeq, toSeq, etlp.getQryDt());
|
|
|
log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN .READ. {}, {}, {}. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, result.size()), job.elapsedTimeStr());
|
|
|
TimeUtils.sleep(500);
|
|
@@ -491,14 +533,13 @@ public class GgitsEtlpService {
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, currWriteCount), job.elapsedTimeStr());
|
|
|
}
|
|
|
}
|
|
|
- etlp.setWriteCount(writeCount);
|
|
|
- etlp.setSuccess(true);
|
|
|
+ etlp.endEtlp(true, writeCount);
|
|
|
log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN WRITE. {}, {}, {} EA. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), writeCount, elapsed.elapsedTimeStr());
|
|
|
log.info("-------------------------------------------------------------------------------------------------");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -506,7 +547,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableResrvPlan));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT_RESRV_PLAN, SCS_T_CON_INTFPLAN ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
|
|
@@ -515,6 +558,7 @@ public class GgitsEtlpService {
|
|
|
Elapsed elapsed = new Elapsed();
|
|
|
Elapsed totElapsed = new Elapsed();
|
|
|
log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP START.");
|
|
|
+ List<HashMap<String, Object>> etlpLists = new ArrayList<>();
|
|
|
List<HashMap<String, Object>> lists = new ArrayList<>();
|
|
|
|
|
|
for (String key : this.centerList) {
|
|
@@ -529,29 +573,26 @@ public class GgitsEtlpService {
|
|
|
int currWriteCount = 0;
|
|
|
Elapsed job = new Elapsed();
|
|
|
EtlpInfo etlp = center.getEtlpSigmap();
|
|
|
- etlp.setSuccess(false);
|
|
|
- etlp.setStartTime(TimeUtils.now());
|
|
|
+ etlp.startEtlp();
|
|
|
+
|
|
|
try {
|
|
|
MDC.put("id", center.getLogKey());
|
|
|
log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP START. {}, {}, {}, {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), center.getMinNodeId(), center.getMaxNodeId());
|
|
|
|
|
|
- Integer dataCount = this.gitsMapper.selectScsTConIntSigmapCount(center);
|
|
|
- etlp.setReadCount(dataCount);
|
|
|
- log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP .READ. {}, {}, {} EA. {}",
|
|
|
- center.getRegionCd(), center.getRegionNm(), dataCount, job.elapsedTimeStr());
|
|
|
+ Integer dataCount = this.gitsMapper.selectScsTConIntSigmapCount(center, EtlpConst.qryCountAll);
|
|
|
+ Integer etlpCount = this.gitsMapper.selectScsTConIntSigmapCount(center, etlp.getQryDt());
|
|
|
+ etlp.setCount(dataCount, etlpCount);
|
|
|
+ log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP .READ. {}, {}, DATA({}) ETLP({}) EA. {}",
|
|
|
+ center.getRegionCd(), center.getRegionNm(), dataCount, etlpCount, job.elapsedTimeStr());
|
|
|
|
|
|
- if (dataCount > 0) {
|
|
|
- int fromSeq, toSeq;
|
|
|
- int pageCount = (dataCount / MAX_PAGE_COUNT) + 1;
|
|
|
- if (0 == (dataCount % MAX_PAGE_COUNT)) {
|
|
|
- pageCount--;
|
|
|
- }
|
|
|
+ if (etlpCount > 0) {
|
|
|
+ int pageCount = getPageCount(etlpCount);
|
|
|
for (int ii = 0; ii < pageCount; ii++) {
|
|
|
- fromSeq = (ii * MAX_PAGE_COUNT);
|
|
|
- toSeq = fromSeq + MAX_PAGE_COUNT;
|
|
|
+ int fromSeq = (ii * this.config.getPageCount());
|
|
|
+ int toSeq = fromSeq + this.config.getPageCount();
|
|
|
fromSeq++;
|
|
|
- List<TbScsTConIntSigmap> result = this.gitsMapper.selectScsTConIntSigmap(center, fromSeq, toSeq);
|
|
|
+ List<TbScsTConIntSigmap> result = this.gitsMapper.selectScsTConIntSigmap(center, fromSeq, toSeq, etlp.getQryDt());
|
|
|
log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP .READ. {}, {}, {}. {}",
|
|
|
center.getRegionCd(), center.getRegionNm(), String.format("%6d ~ %6d, %6d EA", fromSeq, toSeq, result.size()), job.elapsedTimeStr());
|
|
|
TimeUtils.sleep(500);
|
|
@@ -582,7 +623,7 @@ public class GgitsEtlpService {
|
|
|
log.info("<================================================================================================");
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
- etlp.setSuccess(false);
|
|
|
+ etlp.endEtlp(false, writeCount);
|
|
|
log.error("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP: {}, {}, Exceptions: {}", center.getRegionCd(), center.getRegionNm(), e.getMessage());
|
|
|
}
|
|
|
finally {
|
|
@@ -590,7 +631,9 @@ public class GgitsEtlpService {
|
|
|
MDC.remove(center.getLogKey());
|
|
|
MDC.clear();
|
|
|
}
|
|
|
+ etlpLists.add(etlp.toSig(center.getRegionCd(), EtlpConst.etlpTableSignalMap));
|
|
|
}
|
|
|
+ updateEtlpResult(etlpLists);
|
|
|
log.info("TB_INT_SIGNALMAP, SCS_T_CON_INTSIGMAP ..END: {}", totElapsed.elapsedTimeStr());
|
|
|
}
|
|
|
}
|