shjung 2 lat temu
rodzic
commit
1e4fbf365f

+ 4 - 36
src/main/java/com/its/vds/dao/mapper/batch/VdsCtlrDao.java

@@ -4,8 +4,6 @@ import com.its.app.utils.Elapsed;
 import com.its.vds.dao.mapper.BatchDaoService;
 import com.its.vds.entity.TbVdsCtlrStts;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.session.ExecutorType;
-import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.stereotype.Repository;
 
@@ -48,23 +46,8 @@ public class VdsCtlrDao extends BatchDaoService {
     public int updateStts(List<TbVdsCtlrStts> req, boolean isHistory) {
         log.info("{}.updateStts: START. {} EA. History {}", this.serviceName, req.size(), isHistory);
         Elapsed elapsed = new Elapsed();
-        int total = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-
-            this.mapper = this.mapperName + "batchUpdateVdsCtlrStts";
-            total += updateBatch(this.mapper, getSttsList(req));
-
-            sqlSession.commit();
-        } catch(Exception e) {
-            log.error("updateStts: Exception, {}, {}", req, e.getMessage());
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.close();
-            }
-        }
+        this.mapper = this.mapperName + "batchUpdateVdsCtlrStts";
+        int total = updateBatch(this.mapper, getSttsList(req));
         log.info("{}.updateStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
         return total;
     }
@@ -72,23 +55,8 @@ public class VdsCtlrDao extends BatchDaoService {
     public int insertStts(List<TbVdsCtlrStts> req) {
         log.info("{}.insertStts: START. {} EA.", this.serviceName, req.size());
         Elapsed elapsed = new Elapsed();
-        int total = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-
-            this.mapper = this.mapperName + "batchInsertVdsCtlrSttsHs";
-            total += insertBatch(this.mapper, getSttsList(req));
-
-            sqlSession.commit();
-        } catch(Exception e) {
-            log.error("insertStts: Exception, {}, {}", req, e.getMessage());
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.close();
-            }
-        }
+        this.mapper = this.mapperName + "batchInsertVdsCtlrSttsHs";
+        int total = insertBatch(this.mapper, getSttsList(req));
         log.info("{}.insertStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
         return total;
     }

+ 4 - 36
src/main/java/com/its/vds/dao/mapper/batch/VdsDtctDao.java

@@ -4,8 +4,6 @@ import com.its.app.utils.Elapsed;
 import com.its.vds.dao.mapper.BatchDaoService;
 import com.its.vds.entity.voVdsDtctClct;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.session.ExecutorType;
-import org.apache.ibatis.session.SqlSession;
 import org.apache.ibatis.session.SqlSessionFactory;
 import org.springframework.stereotype.Repository;
 
@@ -47,23 +45,8 @@ public class VdsDtctDao extends BatchDaoService {
     public int updateClct(List<voVdsDtctClct> req, boolean isHistory) {
         log.info("{}.updateStts: START. {} EA. History {}", this.serviceName, req.size(), isHistory);
         Elapsed elapsed = new Elapsed();
-        int total = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-
-            this.mapper = this.mapperName + "batchUpdateVdsDtctClctPnst";
-            total += updateBatch(this.mapper, getClctList(req));
-
-            sqlSession.commit();
-        } catch(Exception e) {
-            log.error("updateClct: Exception, {}, {}", req, e.getMessage());
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.close();
-            }
-        }
+        this.mapper = this.mapperName + "batchUpdateVdsDtctClctPnst";
+        int total = updateBatch(this.mapper, getClctList(req));
         log.info("{}.updateStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
         return total;
     }
@@ -71,23 +54,8 @@ public class VdsDtctDao extends BatchDaoService {
     public int insertClct(List<voVdsDtctClct> req) {
         log.info("{}.insertStts: START. {} EA.", this.serviceName, req.size());
         Elapsed elapsed = new Elapsed();
-        int total = 0;
-        SqlSession sqlSession = null;
-        try {
-            sqlSession = this.sqlSessionFactory.openSession(ExecutorType.BATCH, false);
-
-            this.mapper = this.mapperName + "batchInsertVdsDtctClct";
-            total += insertBatch(this.mapper, getClctList(req));
-
-            sqlSession.commit();
-        } catch(Exception e) {
-            log.error("insertClct: Exception, {}, {}", req, e.getMessage());
-        }
-        finally {
-            if (sqlSession != null) {
-                sqlSession.close();
-            }
-        }
+        this.mapper = this.mapperName + "batchInsertVdsDtctClct";
+        int total = insertBatch(this.mapper, getClctList(req));
         log.info("{}.insertStts: ..END. {} EA. {} ms.", this.serviceName, total, elapsed.milliSeconds());
         return total;
     }

+ 1 - 2
src/main/java/com/its/vds/xnettcp/TcpServerVdsComm.java

@@ -4,13 +4,12 @@ import com.its.app.AppUtils;
 import com.its.vds.config.ProcessConfig;
 import lombok.ToString;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
 
 import javax.annotation.PostConstruct;
 
 @Slf4j
 @ToString
-@Component
+//@Component
 public class TcpServerVdsComm extends TcpServerAbstract {
 
     private ProcessConfig processConfig;

+ 2 - 2
src/main/java/com/its/vds/xnettcp/vds/codec/VdsTcpClientDecoder.java

@@ -34,13 +34,13 @@ public class VdsTcpClientDecoder extends ByteToMessageDecoder {
         //TbVdsCtlr obj = AppRepository.getInstance().getCtlrKeyMap().get(objKey);
         TbVdsCtlr obj = AppRepository.getInstance().getCtlrIpMap().get(ipAddress);
         if (obj == null) {
-            log.error("VdsTcpClientDecoder.decode: Unknown Controller IP: {}. will be close.", ipAddress);
+            log.error("CtlrTcpClientDecoder.decode: Unknown Controller IP: {}. will be close.", ipAddress);
             VdsTcpClientIdleHandler.disconnectChannel(channel);
             return;
         }
 
         if (!channel.isOpen() || !channel.isActive()) {
-            log.error("[{}]. RECV: VdsTcpClientDecoder.decode: isOpen: {}, isActive: {}. [{}]", obj.getVDS_CTLR_ID(), channel.isOpen(), channel.isActive(), obj.getLogKey());
+            log.error("[{}]. RECV: CtlrTcpClientDecoder.decode: isOpen: {}, isActive: {}. [{}]", obj.getVDS_CTLR_ID(), channel.isOpen(), channel.isActive(), obj.getLogKey());
             VdsTcpClientIdleHandler.disconnectChannel(channel);
             return;
         }

+ 1 - 1
src/main/java/com/its/vds/xnettcp/vds/handler/VdsTcpClientInboundHandler.java

@@ -21,7 +21,7 @@ public class VdsTcpClientInboundHandler extends ChannelInboundHandlerAdapter {
 
         String ipAddress = NettyUtils.getRemoteIpAddress(ctx.channel());
         if (!(msg instanceof VdsResFramePacket)) {
-            log.error("[{}] | Received Data is not VdsResFramePacket Object", NettyUtils.getRemoteIpAddress(ctx.channel()));
+            log.error("[{}] | Received Data is not CtlrResFramePacket Object", NettyUtils.getRemoteIpAddress(ctx.channel()));
             return;
         }