shjung 11 tháng trước cách đây
mục cha
commit
04f1c85c6c
23 tập tin đã thay đổi với 62 bổ sung752 xóa
  1. 0 8
      conf/its-rota-server.yml
  2. 0 20
      src/main/java/com/its/app/common/cpu/dto/TsiCvimAbnormal.java
  3. 0 23
      src/main/java/com/its/app/common/cpu/dto/TsiCvimControl.java
  4. 0 30
      src/main/java/com/its/app/common/cpu/dto/TsiCvimDto.java
  5. 0 47
      src/main/java/com/its/app/common/cpu/dto/TsiCvimStatus.java
  6. 0 40
      src/main/java/com/its/app/common/cpu/enums/eAckNak.java
  7. 0 45
      src/main/java/com/its/app/common/cpu/enums/eLightsStatus.java
  8. 0 46
      src/main/java/com/its/app/common/cpu/enums/eLightsType.java
  9. 0 43
      src/main/java/com/its/app/common/cpu/enums/eOpCode.java
  10. 0 40
      src/main/java/com/its/app/common/cpu/enums/eTimeReliability.java
  11. 0 85
      src/main/java/com/its/app/common/kafka/KafkaProducerFactory.java
  12. 0 7
      src/main/java/com/its/app/common/service/AbstractService.java
  13. 0 54
      src/main/java/com/its/app/common/worker/Time.java
  14. 0 238
      src/main/java/com/its/app/common/worker/WorkerService.java
  15. 1 0
      src/main/java/com/its/rota/server/dao/mapper/IncidentMapper.java
  16. 0 1
      src/main/java/com/its/rota/server/dao/mapper/ProcessMapper.java
  17. 1 0
      src/main/java/com/its/rota/server/dao/mapper/SndLogMapper.java
  18. 3 0
      src/main/java/com/its/rota/server/process/dbms/DbmsData.java
  19. 23 11
      src/main/java/com/its/rota/server/process/dbms/DbmsDataProcess.java
  20. 11 4
      src/main/java/com/its/rota/server/scheduler/ApplicationScheduler.java
  21. 3 5
      src/main/resources/application.yml
  22. 7 0
      src/main/resources/mybatis/mapper/IncidentMapper.xml
  23. 13 5
      src/main/resources/mybatis/mapper/SndLogMapper.xml

+ 0 - 8
conf/its-rota-server.yml

@@ -2,11 +2,3 @@ spring:
   profiles:
     active: dev
 
-application:
-  kafka:
-    producer:
-      dd:
-    consumer:
-
-  ggits-server-ip: 192.168.24.22
-#  ggits-server-ip: 127.0.0.1

+ 0 - 20
src/main/java/com/its/app/common/cpu/dto/TsiCvimAbnormal.java

@@ -1,20 +0,0 @@
-package com.its.app.common.cpu.dto;
-
-import com.its.app.common.utils.StringUtils;
-import lombok.Data;
-import lombok.ToString;
-
-@Data
-@ToString
-public class TsiCvimAbnormal {
-    public boolean inSignalConflict;
-    public boolean inCenterComm;
-    public boolean inScuComm;
-
-
-    public String toDataString() {
-        return StringUtils.getString(this.inSignalConflict)
-                + StringUtils.getString(this.inCenterComm)
-                + StringUtils.getString(this.inScuComm);
-    }
-}

+ 0 - 23
src/main/java/com/its/app/common/cpu/dto/TsiCvimControl.java

@@ -1,23 +0,0 @@
-package com.its.app.common.cpu.dto;
-
-import com.its.app.common.utils.StringUtils;
-import lombok.Data;
-import lombok.ToString;
-
-@Data
-@ToString
-public class TsiCvimControl {
-    public boolean inManualControl;
-    public boolean inFlashingControl;
-    public boolean inLightsOutControl;
-    public boolean inActuationControl;
-    public boolean inTransitionControl;
-
-    public String toDataString() {
-        return StringUtils.getString(this.inManualControl)
-             + StringUtils.getString(this.inFlashingControl)
-             + StringUtils.getString(this.inLightsOutControl)
-             + StringUtils.getString(this.inActuationControl)
-             + StringUtils.getString(this.inTransitionControl);
-    }
-}

+ 0 - 30
src/main/java/com/its/app/common/cpu/dto/TsiCvimDto.java

@@ -1,30 +0,0 @@
-package com.its.app.common.cpu.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.ArrayList;
-import java.util.List;
-
-@Slf4j
-@Getter
-@Setter
-@ToString
-public class TsiCvimDto {
-
-    protected long _id;
-    protected long nodeId;
-    protected boolean isConnect;
-    protected String collectTime;
-    protected String tscDateTime;
-    protected int cycleElapsedTime;
-    protected TsiCvimControl tscControlInfo = new TsiCvimControl();
-    protected TsiCvimAbnormal tscAbnormalInfo = new TsiCvimAbnormal();
-    protected int signalStatusInfoCount;
-    protected List<TsiCvimStatus> signalStatusInfos = new ArrayList<>();
-
-    public TsiCvimDto() {
-    }
-}

+ 0 - 47
src/main/java/com/its/app/common/cpu/dto/TsiCvimStatus.java

@@ -1,47 +0,0 @@
-package com.its.app.common.cpu.dto;
-
-import com.its.app.common.cpu.enums.eLightsStatus;
-import com.its.app.common.cpu.enums.eLightsType;
-import com.its.app.common.cpu.enums.eTimeReliability;
-import com.its.app.common.utils.StringUtils;
-import lombok.Data;
-import lombok.ToString;
-
-@Data
-@ToString
-public class TsiCvimStatus {
-    protected eLightsType lightsType;
-    protected eTimeReliability timeReliability;
-    protected boolean readyPedestrianSignal;
-    protected boolean unProtectedSignal;
-    protected eLightsStatus lightsStatus;
-    protected int totalSeconds;
-    protected int remainingSeconds;
-    protected int directionCode;
-
-    public void copy(TsiCvimStatus statusTmp) {
-        statusTmp.lightsType = this.lightsType;
-        statusTmp.timeReliability = this.timeReliability;
-        statusTmp.readyPedestrianSignal = this.readyPedestrianSignal;
-        statusTmp.unProtectedSignal = this.unProtectedSignal;
-        statusTmp.lightsStatus = this.lightsStatus;
-        statusTmp.totalSeconds = this.totalSeconds;
-        statusTmp.remainingSeconds = this.remainingSeconds;
-        statusTmp.directionCode = this.directionCode;
-    }
-
-
-    public String toDataString() {
-        return    this.lightsType.getValue()
-                + this.timeReliability.getValue()
-                + StringUtils.getString(this.readyPedestrianSignal)
-                + StringUtils.getString(this.unProtectedSignal)
-                + this.lightsStatus.getValue()
-                + ","
-                + this.totalSeconds
-                + ","
-                + this.remainingSeconds
-                + ","
-                + this.directionCode;
-    }
-}

+ 0 - 40
src/main/java/com/its/app/common/cpu/enums/eAckNak.java

@@ -1,40 +0,0 @@
-package com.its.app.common.cpu.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eAckNak {
-
-    TSI_CPU_ACK (0x06, "TSI_CPU_ACK"),  //ack
-    TSI_CPU_NAK (0x15, "TSI_CPU_NAK");  //nack
-
-    private final int value;
-    private final String string;
-
-    private static final Map<Integer, eAckNak> map;
-    static {
-        map = new HashMap<>();
-        for (eAckNak e : values()) {
-            map.put(Integer.valueOf(e.value), e);
-        }
-    }
-    public static eAckNak getByValue(int value) {
-        return map.get(Integer.valueOf(value));
-    }
-    public static eAckNak getByValue(byte value) {
-        int intValue = (int)(value & 0x0F);
-        return getByValue(intValue);
-    }
-
-    eAckNak(int value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-    public String toString() {
-        return this.string;
-    }
-}

+ 0 - 45
src/main/java/com/its/app/common/cpu/enums/eLightsStatus.java

@@ -1,45 +0,0 @@
-package com.its.app.common.cpu.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eLightsStatus {
-
-    LIGHTS_OUT   (0, "LIGHTS_OUT"),     //소등
-    RED_SOLID    (1, "RED_SOLID"),      //적색점등
-    YELLOW_SOLID (2, "YELLOW_SOLID"),   //황색점등
-    GREEN_SOLID  (3, "GREEN_SOLID"),    //녹색점등
-    RED_BLINK    (4, "RED_BLINK"),      //적색점멸
-    YELLOW_BLINK (5, "YELLOW_BLINK"),   //황색점멸
-    GREEN_BLINK  (6, "GREEN_BLINK");    //녹색점멸
-
-    private final int value;
-    private final String string;
-
-    private static final Map<Integer, eLightsStatus> map;
-    static {
-        map = new HashMap<>();
-        for (eLightsStatus e : values()) {
-            map.put(Integer.valueOf(e.value), e);
-        }
-    }
-    public static eLightsStatus getByValue(int value) {
-        return map.get(Integer.valueOf(value));
-    }
-    public static eLightsStatus getByValue(byte value) {
-        int intValue = (int)(value & 0x0F);
-        return getByValue(intValue);
-    }
-
-    eLightsStatus(int value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-    public String toString() {
-        return this.string;
-    }
-}

+ 0 - 46
src/main/java/com/its/app/common/cpu/enums/eLightsType.java

@@ -1,46 +0,0 @@
-package com.its.app.common.cpu.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eLightsType {
-
-    UNSPECIFIED(0, "UNSPECIFIED"),  //미지정
-    STRAIGHT   (1, "STRAIGHT"),     //직진
-    LEFT_TURN  (2, "LEFT_TURN"),    //좌회전
-    PEDESTRIAN (3, "PEDESTRIAN"),   //보행자
-    BICYCLE    (4, "BICYCLE"),      //자전거
-    RIGHT_TURN (5, "RIGHT_TURN"),   //우회전
-    BUS        (6, "BUS"),          //버스
-    U_TURN     (7, "U_TURN");       //유턴
-
-    private final int value;
-    private final String string;
-
-    private static final Map<Integer, eLightsType> map;
-    static {
-        map = new HashMap<>();
-        for (eLightsType e : values()) {
-            map.put(Integer.valueOf(e.value), e);
-        }
-    }
-    public static eLightsType getByValue(int value) {
-        return map.get(Integer.valueOf(value));
-    }
-    public static eLightsType getByValue(byte value) {
-        int intValue = (int)(value & 0x0F);
-        return getByValue(intValue);
-    }
-
-    eLightsType(int value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-    public String toString() {
-        return this.string;
-    }
-}

+ 0 - 43
src/main/java/com/its/app/common/cpu/enums/eOpCode.java

@@ -1,43 +0,0 @@
-package com.its.app.common.cpu.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eOpCode {
-
-    TSI_CPU_SIGNAL_NOTIFY  (0x13, "TSI_CPU_SIGNAL_NOTIFY"),     // 신호상태정보 전송 (BIN)
-    TSI_CPU_PVD_NOTIFY     (0x14, "TSI_CPU_PVD_NOTIFY"),        // 차량운행정보(PVD) 전송 (BIN)
-    TSI_CPU_PVD_ASN_NOTIFY (0x15, "TSI_CPU_PVD_ASN_NOTIFY"),    // 차량운행정보(PVD) 전송 (ASN.1)
-    TSI_CPU_SIGNAL_ADD     (0xFE, "TSI_CPU_SIGNAL_ADD"),        // 신호상태정보 연등지
-    TSI_CPU_DISCONNECTED   (0xFF, "TSI_CPU_DISCONNECTED");      // 신호제어기 연결 종료(내부사용)
-
-    private final int value;
-    private final String string;
-
-    private static final Map<Integer, eOpCode> map;
-    static {
-        map = new HashMap<>();
-        for (eOpCode e : values()) {
-            map.put(Integer.valueOf(e.value), e);
-        }
-    }
-    public static eOpCode getByValue(int value) {
-        return map.get(Integer.valueOf(value));
-    }
-    public static eOpCode getByValue(byte value) {
-        int intValue = (int)(value & 0x0F);
-        return getByValue(intValue);
-    }
-
-    eOpCode(int value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-    public String toString() {
-        return this.string;
-    }
-}

+ 0 - 40
src/main/java/com/its/app/common/cpu/enums/eTimeReliability.java

@@ -1,40 +0,0 @@
-package com.its.app.common.cpu.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public enum eTimeReliability {
-
-    FIXED_TIMING    (0, "FIXED_TIMING"),        //고정신호시간
-    VARIABLE_TIMING (1, "VARIABLE_TIMING");     //가변신호시간
-
-    private final int value;
-    private final String string;
-
-    private static final Map<Integer, eTimeReliability> map;
-    static {
-        map = new HashMap<>();
-        for (eTimeReliability e : values()) {
-            map.put(Integer.valueOf(e.value), e);
-        }
-    }
-    public static eTimeReliability getByValue(int value) {
-        return map.get(Integer.valueOf(value));
-    }
-    public static eTimeReliability getByValue(byte value) {
-        int intValue = (int)(value & 0x0F);
-        return getByValue(intValue);
-    }
-
-    eTimeReliability(int value, String string) {
-        this.value  = value;
-        this.string = string;
-    }
-
-    public int getValue() {
-        return this.value;
-    }
-    public String toString() {
-        return this.string;
-    }
-}

+ 0 - 85
src/main/java/com/its/app/common/kafka/KafkaProducerFactory.java

@@ -1,85 +0,0 @@
-package com.its.app.common.kafka;
-
-import org.apache.kafka.clients.producer.ProducerConfig;
-import org.springframework.kafka.core.DefaultKafkaProducerFactory;
-import org.springframework.kafka.core.KafkaTemplate;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-public class KafkaProducerFactory {
-
-    public static <K,V> KafkaTemplate<K, V> createByteArrayTemplate(String bootstrapServers, List<Map<String, String>> props) {
-        Map<String, Object> configs = new HashMap<>();
-        configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
-        configs.put("enable.idempotence", false);
-        configs.put(ProducerConfig.ACKS_CONFIG, "0");
-        configs.put(ProducerConfig.RETRIES_CONFIG, 0);
-        configs.put(ProducerConfig.LINGER_MS_CONFIG, 1);
-        configs.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 3000);
-        configs.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 4000);
-        //configs.put("queue.buffering.max.messages", 10000000);
-        //configs.put("queue.buffering.max.kbytes", 2147483647);
-        //configs.put("queue.buffering.max.ms", 0);
-        //configs.put("api.version.request", false);
-        configs.put(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG, 5000);
-        configs.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.StringSerializer.class);
-        configs.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.ByteArraySerializer.class);
-
-        for (Map<String, String> prop : props) {
-            for (Map.Entry<String, String> elem : prop.entrySet()) {
-                String key = elem.getKey();
-                String val = elem.getValue();
-                if (val != null) {
-                    if (val.equals("true") || val.equals("false")) {
-                        configs.put(key, val.equals("true"));
-                    } else {
-                        configs.put(key, val);
-                    }
-                }
-            }
-        }
-
-        DefaultKafkaProducerFactory<K, V> defaultKafkaProducerFactory = new DefaultKafkaProducerFactory<>(configs);
-        return new KafkaTemplate<>(defaultKafkaProducerFactory);
-    }
-
-    public static <K,V> KafkaTemplate<K, V> createProducerTemplate(Map<String, Object> props) {
-        DefaultKafkaProducerFactory<K, V> defaultKafkaProducerFactory = new DefaultKafkaProducerFactory<>(props);
-        return new KafkaTemplate<>(defaultKafkaProducerFactory);
-    }
-
-    public static Properties getProperties(String bootstrapServers, List<Map<String, String>> props) {
-        Properties properties  = new Properties();
-        properties.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
-        properties.put("enable.idempotence", false);
-        properties.put(ProducerConfig.ACKS_CONFIG, "0");
-        properties.put(ProducerConfig.RETRIES_CONFIG, 0);
-        properties.put(ProducerConfig.LINGER_MS_CONFIG, 1);
-        properties.put(ProducerConfig.REQUEST_TIMEOUT_MS_CONFIG, 3000);
-        properties.put(ProducerConfig.DELIVERY_TIMEOUT_MS_CONFIG, 4000);
-        //properties.put("queue.buffering.max.messages", 10000000);
-        //properties.put("queue.buffering.max.kbytes", 2147483647);
-        //properties.put("queue.buffering.max.ms", 0);
-        //properties.put("api.version.request", false);
-        properties.put("transaction.timeout.ms", 5000);
-        properties.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.StringSerializer.class);
-        properties.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, org.apache.kafka.common.serialization.ByteArraySerializer.class);
-        for (Map<String, String> prop : props) {
-            for (Map.Entry<String, String> elem : prop.entrySet()) {
-                String key = elem.getKey();
-                String val = elem.getValue();
-                if (val != null) {
-                    if (val.equals("true") || val.equals("false")) {
-                        properties.put(key, val.equals("true"));
-                    } else {
-                        properties.put(key, val);
-                    }
-                }
-            }
-        }
-        return properties ;
-    }
-}

+ 0 - 7
src/main/java/com/its/app/common/service/AbstractService.java

@@ -1,7 +0,0 @@
-package com.its.app.common.service;
-
-public abstract class AbstractService {
-
-    public abstract void start() throws Exception;
-    public abstract void stop() throws Exception;
-}

+ 0 - 54
src/main/java/com/its/app/common/worker/Time.java

@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.its.app.common.worker;
-
-import java.util.Date;
-
-public class Time {
-
-    /**
-     * Returns time in milliseconds as does System.currentTimeMillis(),
-     * but uses elapsed time from an arbitrary epoch more like System.nanoTime().
-     * The difference is that if somebody changes the system clock,
-     * Time.currentElapsedTime will change but nanoTime won't. On the other hand,
-     * all of ZK assumes that time is measured in milliseconds.
-     * @return The time in milliseconds from some arbitrary point in time.
-     */
-    public static long currentElapsedTime() {
-        return System.nanoTime() / 1000000;
-    }
-
-    /**
-     * Explicitly returns system dependent current wall time.
-     * @return Current time in msec.
-     */
-    public static long currentWallTime() {
-        return System.currentTimeMillis();
-    }
-
-    /**
-     * This is to convert the elapsedTime to a Date.
-     * @return A date object indicated by the elapsedTime.
-     */
-    public static Date elapsedTimeToDate(long elapsedTime) {
-        long wallTime = currentWallTime() + elapsedTime - currentElapsedTime();
-        return new Date(wallTime);
-    }
-
-}

+ 0 - 238
src/main/java/com/its/app/common/worker/WorkerService.java

@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.its.app.common.worker;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.ArrayList;
-import java.util.concurrent.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * WorkerService is a worker thread pool for running tasks and is implemented
- * using one or more ExecutorServices. A WorkerService can support assignable
- * threads, which it does by creating N separate single thread ExecutorServices,
- * or non-assignable threads, which it does by creating a single N-thread
- * ExecutorService.
- *   - NIOServerCnxnFactory uses a non-assignable WorkerService because the
- *     socket IO requests are order independent and allowing the
- *     ExecutorService to handle thread assignment gives optimal performance.
- *   - CommitProcessor uses an assignable WorkerService because requests for
- *     a given session must be processed in order.
- * ExecutorService provides queue management and thread restarting, so it's
- * useful even with a single thread.
- */
-@Slf4j
-public class WorkerService {
-
-    private final ArrayList<ExecutorService> workers = new ArrayList<ExecutorService>();
-
-    private final String threadNamePrefix;
-    private int numWorkerThreads;
-    private boolean threadsAreAssignable;
-    private long shutdownTimeoutMS = 5000;
-
-    private volatile boolean stopped = true;
-
-    /**
-     * @param name                  worker threads are named &lt;name&gt;Thread-##
-     * @param numThreads            number of worker threads (0 - N)
-     *                              If 0, scheduled work is run immediately by
-     *                              the calling thread.
-     * @param useAssignableThreads  whether the worker threads should be
-     *                              individually assignable or not
-     */
-    public WorkerService(String name, int numThreads, boolean useAssignableThreads) {
-        this.threadNamePrefix = (name == null ? "" : name) + "Thread";
-        this.numWorkerThreads = numThreads;
-        this.threadsAreAssignable = useAssignableThreads;
-        start();
-    }
-
-    /**
-     * Callers should implement a class extending WorkRequest in order to
-     * schedule work with the service.
-     */
-    public abstract static class WorkRequest {
-
-        /**
-         * Must be implemented. Is called when the work request is run.
-         */
-        public abstract void doWork() throws Exception;
-
-        /**
-         * (Optional) If implemented, is called if the service is stopped
-         * or unable to schedule the request.
-         */
-        public void cleanup() {
-        }
-
-    }
-
-    /**
-     * Schedule work to be done.  If a worker thread pool is not being
-     * used, work is done directly by this thread. This schedule API is
-     * for use with non-assignable WorkerServices. For assignable
-     * WorkerServices, will always run on the first thread.
-     */
-    public void schedule(WorkRequest workRequest) {
-        schedule(workRequest, 0);
-    }
-
-    /**
-     * Schedule work to be done by the thread assigned to this id. Thread
-     * assignment is a single mod operation on the number of threads.  If a
-     * worker thread pool is not being used, work is done directly by
-     * this thread.
-     */
-    public void schedule(WorkRequest workRequest, long id) {
-        if (stopped) {
-            workRequest.cleanup();
-            return;
-        }
-
-        ScheduledWorkRequest scheduledWorkRequest = new ScheduledWorkRequest(workRequest);
-
-        // If we have a worker thread pool, use that; otherwise, do the work
-        // directly.
-        int size = workers.size();
-        if (size > 0) {
-            try {
-                // make sure to map negative ids as well to [0, size-1]
-                int workerNum = ((int) (id % size) + size) % size;
-                log.error("schedule: {}, size: {}, workNum: {}", id, size, workerNum);
-                ExecutorService worker = workers.get(workerNum);
-                worker.execute(scheduledWorkRequest);
-            } catch (RejectedExecutionException e) {
-                log.warn("ExecutorService rejected execution", e);
-                workRequest.cleanup();
-            }
-        } else {
-            // When there is no worker thread pool, do the work directly
-            // and wait for its completion
-            log.error("schedule: {}, size: {}", id, size);
-            scheduledWorkRequest.run();
-        }
-    }
-
-    private class ScheduledWorkRequest implements Runnable {
-
-        private final WorkRequest workRequest;
-
-        ScheduledWorkRequest(WorkRequest workRequest) {
-            this.workRequest = workRequest;
-        }
-
-        @Override
-        public void run() {
-            try {
-                // Check if stopped while request was on queue
-                if (stopped) {
-                    workRequest.cleanup();
-                    return;
-                }
-                workRequest.doWork();
-            } catch (Exception e) {
-                log.warn("Unexpected exception", e);
-                workRequest.cleanup();
-            }
-        }
-
-    }
-
-    /**
-     * ThreadFactory for the worker thread pool. We don't use the default
-     * thread factory because (1) we want to give the worker threads easier
-     * to identify names; and (2) we want to make the worker threads daemon
-     * threads so they don't block the server from shutting down.
-     */
-    private static class DaemonThreadFactory implements ThreadFactory {
-
-        final ThreadGroup group;
-        final AtomicInteger threadNumber = new AtomicInteger(1);
-        final String namePrefix;
-
-        DaemonThreadFactory(String name) {
-            this(name, 1);
-        }
-
-        DaemonThreadFactory(String name, int firstThreadNum) {
-            threadNumber.set(firstThreadNum);
-            SecurityManager s = System.getSecurityManager();
-            group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
-            namePrefix = name + "-";
-        }
-
-        public Thread newThread(Runnable r) {
-            Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
-            if (!t.isDaemon()) {
-                t.setDaemon(true);
-            }
-            if (t.getPriority() != Thread.NORM_PRIORITY) {
-                t.setPriority(Thread.NORM_PRIORITY);
-            }
-            return t;
-        }
-
-    }
-
-    public void start() {
-        if (numWorkerThreads > 0) {
-            if (threadsAreAssignable) {
-                for (int i = 1; i <= numWorkerThreads; ++i) {
-                    workers.add(Executors.newFixedThreadPool(1, new DaemonThreadFactory(threadNamePrefix, i)));
-                }
-            } else {
-                workers.add(Executors.newFixedThreadPool(numWorkerThreads, new DaemonThreadFactory(threadNamePrefix)));
-            }
-        }
-        stopped = false;
-    }
-
-    public void stop() {
-        stopped = true;
-
-        // Signal for graceful shutdown
-        for (ExecutorService worker : workers) {
-            worker.shutdown();
-        }
-    }
-
-    public void join(long shutdownTimeoutMS) {
-        // Give the worker threads time to finish executing
-        long now = Time.currentElapsedTime();
-        long endTime = now + shutdownTimeoutMS;
-        for (ExecutorService worker : workers) {
-            boolean terminated = false;
-            while ((now = Time.currentElapsedTime()) <= endTime) {
-                try {
-                    terminated = worker.awaitTermination(endTime - now, TimeUnit.MILLISECONDS);
-                    break;
-                } catch (InterruptedException e) {
-                    // ignore
-                }
-            }
-            if (!terminated) {
-                // If we've timed out, do a hard shutdown
-                worker.shutdownNow();
-            }
-        }
-    }
-
-}

+ 1 - 0
src/main/java/com/its/rota/server/dao/mapper/IncidentMapper.java

@@ -15,4 +15,5 @@ public interface IncidentMapper {
     int insSndIncident(@Param("obj") TbCheckIncident obj);
     int updSndIncident(@Param("obj") TbSndLog obj);
     List<TbSndIncident> selSndIncident(@Param("obj") TbCheckIncident obj);
+    int deleteSndIncident();
 }

+ 0 - 1
src/main/java/com/its/rota/server/dao/mapper/ProcessMapper.java

@@ -8,7 +8,6 @@ import org.apache.ibatis.annotations.Param;
 public interface ProcessMapper {
 
     int initProcessStts();
-
     int updProcessState(@Param("obj") TbProcessState obj);
     int updProcessStateStart(@Param("obj") TbProcessState obj);
     int updProcessStateStop(@Param("obj") TbProcessState obj);

+ 1 - 0
src/main/java/com/its/rota/server/dao/mapper/SndLogMapper.java

@@ -9,4 +9,5 @@ public interface SndLogMapper {
 
     int insSndLog(@Param("obj") TbSndLog obj);
     int insCenterSend(@Param("obj") TbSndLog obj);
+    int deleteSndLog();
 }

+ 3 - 0
src/main/java/com/its/rota/server/process/dbms/DbmsData.java

@@ -15,6 +15,9 @@ public class DbmsData {
     public static final int DBMS_DATA_LOG_INCIDENT = 1;
     public static final int DBMS_DATA_LOG_TRAFFIC = 2;
 
+    public static final int DBMS_DATA_DELETE_SND_LOG = 10;
+    public static final int DBMS_DATA_DELETE_SND_INCIDENT = 11;
+
     private long      timestamp;
     private CenterDto center;
     private int       type;

+ 23 - 11
src/main/java/com/its/rota/server/process/dbms/DbmsDataProcess.java

@@ -56,7 +56,6 @@ public class DbmsDataProcess {
                 }
             });
         }
-
         log.info("DbmsDataProcess.run: ..end.");
     }
 
@@ -66,6 +65,12 @@ public class DbmsDataProcess {
 
     public void process(DbmsData data) {
         int type = data.getType();
+        int result = 0;
+        if (data.getCenter() == null) {
+            log.error("DbmsDataProcess.process: Unknown Center Info.");
+            return;
+        }
+
         try {
             MDC.put("id", data.getCenter().getLogKey());
             Elapsed elapsed1 = new Elapsed();
@@ -73,38 +78,45 @@ public class DbmsDataProcess {
                 case DbmsData.DBMS_DATA_PROCESS_STTS:
                     TbProcessState stts = (TbProcessState) data.getData();
                     if (TbProcessState.PROCESS_START.equals(stts.getRunState())) {
-                        this.processMapper.updProcessStateStart(stts);
+                        result = this.processMapper.updProcessStateStart(stts);
                     }
                     else if (TbProcessState.PROCESS_STOP.equals(stts.getRunState())) {
-                        this.processMapper.updProcessStateStop(stts);
+                        result = this.processMapper.updProcessStateStop(stts);
                     }
                     else {
-                        this.processMapper.updProcessState(stts);
+                        result = this.processMapper.updProcessState(stts);
                     }
                     break;
                 case DbmsData.DBMS_DATA_LOG_INCIDENT:
                     TbSndLog incLog = (TbSndLog) data.getData();
-                    this.sndLogMapper.insSndLog(incLog);
+                    result = this.sndLogMapper.insSndLog(incLog);
                     if (DbmsData.D_KIND_INC.equals(incLog.getInfoKind())) {
-                        this.incidentMapper.updSndIncident(incLog);
+                        result += this.incidentMapper.updSndIncident(incLog);
                         incLog.setInfoKind("E1");
-                        this.sndLogMapper.insSndLog(incLog);
+                        result += this.sndLogMapper.insSndLog(incLog);
                     }
                     break;
                 case DbmsData.DBMS_DATA_LOG_TRAFFIC:
                     TbSndLog trfLog = (TbSndLog) data.getData();
-                    this.sndLogMapper.insSndLog(trfLog);
+                    result = this.sndLogMapper.insSndLog(trfLog);
                     if (DbmsData.D_KIND_TRAF.equals(trfLog.getInfoKind())) {
                         trfLog.setInfoKind("R1");
-                        this.sndLogMapper.insSndLog(trfLog);
+                        result += this.sndLogMapper.insSndLog(trfLog);
                     }
                     break;
+                case DbmsData.DBMS_DATA_DELETE_SND_LOG:
+                    result = this.sndLogMapper.deleteSndLog();
+                    break;
+                case DbmsData.DBMS_DATA_DELETE_SND_INCIDENT:
+                    result = this.incidentMapper.deleteSndIncident();
+                    break;
                 default:
+                    result = -1;
                     log.error("DbmsDataProcess.process: Unknown Request {}.", type);
                     break;
             }
-            log.info("AiPublicationTraffic.run: [{}, {}]. {}, {}",
-                    data.getCenter().getLogKey(), data.getCenter().getIpAddress(), type, Elapsed.elapsedTimeStr(elapsed1.nanoSeconds()));
+            log.info("DbmsDataProcess.run: [{}, {}]. {}, {} EA. {}",
+                    data.getCenter().getLogKey(), data.getCenter().getIpAddress(), type, result, Elapsed.elapsedTimeStr(elapsed1.nanoSeconds()));
         }
         catch (Exception e) {
             log.error("DbmsDataProcess.process: Exception: {}", e.toString());

+ 11 - 4
src/main/java/com/its/rota/server/scheduler/ApplicationScheduler.java

@@ -2,8 +2,10 @@ package com.its.rota.server.scheduler;
 
 import com.its.app.common.utils.Elapsed;
 import com.its.rota.server.config.SchedulingConfig;
+import com.its.rota.server.process.dbms.DbmsData;
+import com.its.rota.server.process.dbms.DbmsDataProcess;
+import com.its.rota.server.repository.ApplicationRepository;
 import com.its.rota.server.service.ItsRotaServerService;
-import com.its.rota.server.service.UnitSystService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;
@@ -19,10 +21,13 @@ import javax.annotation.PreDestroy;
 @Component
 public class ApplicationScheduler {
 
-    private final UnitSystService unitSystService;
     private final SchedulingConfig config;
+    private final DbmsDataProcess dbmsDataProcess;
     private final ItsRotaServerService itsRotaServerService;
 
+    private final DbmsData delSndLog = new DbmsData(null, DbmsData.DBMS_DATA_DELETE_SND_LOG, null);
+    private final DbmsData delSndIncident = new DbmsData(null, DbmsData.DBMS_DATA_DELETE_SND_INCIDENT, null);
+
     @PreDestroy
     public void onShutDown() {
     }
@@ -51,7 +56,8 @@ public class ApplicationScheduler {
         Elapsed elapsed = new Elapsed();
         log.info("ApplicationScheduler.deleteSndIncident: start.");
         try {
-            //this.deleteService.deleteSndIncident();
+            this.delSndIncident.setCenter(ApplicationRepository.center);
+            this.dbmsDataProcess.add(this.delSndIncident);
             log.info("ApplicationScheduler.deleteSndIncident: {}", Elapsed.elapsedTimeStr(elapsed.nanoSeconds()));
         }
         catch(Exception e) {
@@ -68,7 +74,8 @@ public class ApplicationScheduler {
         Elapsed elapsed = new Elapsed();
         log.info("ApplicationScheduler.deleteSndLog: start.");
         try {
-//            this.deleteService.deleteSndLog();
+            this.delSndLog.setCenter(ApplicationRepository.center);
+            this.dbmsDataProcess.add(this.delSndLog);
             log.info("ApplicationScheduler.deleteSndLog: {}", Elapsed.elapsedTimeStr(elapsed.nanoSeconds()));
         }
         catch(Exception e) {

+ 3 - 5
src/main/resources/application.yml

@@ -15,12 +15,10 @@ spring:
       enabled: always
   datasource:
     hikari:
-#      driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
-#      jdbc-url: jdbc:log4jdbc:oracle:thin:@115.91.94.42:1521:HANTE
       driver-class-name: oracle.jdbc.OracleDriver
-      jdbc-url: jdbc:oracle:thin:@115.91.94.42:1521:HANTE
-      username: sigtest
-      password: sigtest
+      jdbc-url: jdbc:oracle:thin:@192.168.10.21:1521:UTIS
+      username: section
+      password: section
       connection-test-query: SELECT 1 FROM DUAL
       minimumIdle: 5
       maximumPoolSize: 20

+ 7 - 0
src/main/resources/mybatis/mapper/IncidentMapper.xml

@@ -85,4 +85,11 @@
         ]]>
     </select>
 
+    <delete id="deleteSndIncident">
+        <![CDATA[
+        DELETE FROM SND_INCIDENT
+        WHERE logdate < SYSDATE - 720/1440 -- 12 시간전
+        ]]>
+    </delete>
+
 </mapper>

+ 13 - 5
src/main/resources/mybatis/mapper/SndLogMapper.xml

@@ -10,18 +10,26 @@
         ]]>
     </insert>
 
-    <insert id="insCenterSendx" parameterType="com.its.rota.server.entity.TbSndLog">
+    <insert id="insCenterSend" parameterType="com.its.rota.server.entity.TbSndLog">
         <![CDATA[
         INSERT INTO CENTER_SEND@UTISDB(logdate, centerid, infotype, datacnt)
         VALUES(SYSDATE, #{obj.toCenterId}, #{obj.infoKind}, #{obj.dataCnt})
         ]]>
     </insert>
 
-    <insert id="insCenterSend" parameterType="com.its.rota.server.entity.TbSndLog">
+<!--    <insert id="insCenterSend" parameterType="com.its.rota.server.entity.TbSndLog">-->
+<!--        <![CDATA[-->
+<!--        INSERT INTO UTIADMIN_CENTER_SEND(logdate, centerid, infotype, datacnt)-->
+<!--        VALUES(SYSDATE, #{obj.toCenterId}, #{obj.infoKind}, #{obj.dataCnt})-->
+<!--        ]]>-->
+<!--    </insert>-->
+
+
+    <delete id="deleteSndLog">
         <![CDATA[
-        INSERT INTO UTIADMIN_CENTER_SEND(logdate, centerid, infotype, datacnt)
-        VALUES(SYSDATE, #{obj.toCenterId}, #{obj.infoKind}, #{obj.dataCnt})
+        DELETE FROM SND_LOG
+        WHERE logdate < SYSDATE - 2
         ]]>
-    </insert>
+    </delete>
 
 </mapper>