shjung 2 years ago
parent
commit
c0632b2bf7

+ 2 - 2
src/main/java/com/its/op/scheduler/job/FcltSttsJobThread.java

@@ -73,10 +73,10 @@ public class FcltSttsJobThread {
             ItsWebSocketSessionManager.getInstance().sendBroadcastMessage(itsMessage.getCommand(), new TextMessage(itsSttsJsonData));
         }
         catch(JsonProcessingException e){
-            log.error("FcltSttsJobThread ItsFcltSttsDto Json parsing Exception: {}", itsSttsDto);
+            log.error("cltSttsJobThread.notify: ItsFcltSttsDto Json parsing Exception: {}", itsSttsDto);
         }
 
         stopWatch.stop();
-        log.info("FcltSttsJobThread.notifyFcltStts:--END. {}, {} ms.", Thread.currentThread().getName(), stopWatch.getTotalTimeMillis());
+        log.info("FcltSttsJobThread.notify:--END. {}, {} ms.", Thread.currentThread().getName(), stopWatch.getTotalTimeMillis());
     }
 }

+ 32 - 37
src/main/java/com/its/op/service/its/oper/TbUserGropMenuAthrService.java

@@ -4,7 +4,9 @@ import com.its.op.dao.repository.its.oper.TbOperSystMenuRepository;
 import com.its.op.dao.repository.its.oper.TbUserGropInfrRepository;
 import com.its.op.dao.repository.its.oper.TbUserGropMenuAthrRepository;
 import com.its.op.dto.its.oper.TbUserGropMenuAthrDto;
-import com.its.op.entity.its.oper.*;
+import com.its.op.entity.its.oper.TbOperSystMenu;
+import com.its.op.entity.its.oper.TbUserGropInfr;
+import com.its.op.entity.its.oper.TbUserGropMenuAthr;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -13,65 +15,58 @@ import org.springframework.transaction.annotation.Transactional;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Optional;
 
 @Slf4j
 @RequiredArgsConstructor
 @Service
 public class TbUserGropMenuAthrService {
 
-    private final TbUserGropMenuAthrRepository repo;
-    private final TbUserGropInfrRepository userGropRepo;
-    private final TbOperSystMenuRepository systMenuRepo;
+    private final TbUserGropMenuAthrRepository userGropMenuAthrRepo;
+    private final TbUserGropInfrRepository userGropInfrRepo;
+    private final TbOperSystMenuRepository operSystMenuRepo;
 
     // 전체 데이터 조회
     @Transactional(readOnly = true)
     public List<TbUserGropMenuAthrDto> findAll() {
         List<TbUserGropMenuAthrDto> result = new ArrayList<>();
 
-        List<TbUserGropInfr> userGrops = this.userGropRepo.findAll();
-        List<TbOperSystMenu> systMenus = this.systMenuRepo.findAll();
-        List<TbUserGropMenuAthr> menuAuths = this.repo.findAll();
+        List<TbUserGropInfr> userGropInfrList = this.userGropInfrRepo.findAll();
+        List<TbOperSystMenu> operSystMenuList = this.operSystMenuRepo.findAll();
+        List<TbUserGropMenuAthr> userGropMenuAthrList = this.userGropMenuAthrRepo.findAll();
 
         // 메뉴 중에 최상위 메뉴 선택
         HashMap<String, String> systMenuMap = new HashMap<>();
-        for (TbOperSystMenu systMenu : systMenus) {
-//            if (!"ITSOP".equals(systMenu.getOperSystId())) {
-//                continue;
-//            }
+        for (TbOperSystMenu systMenu : operSystMenuList) {
             if (("N").equals(systMenu.getDelYn()) & systMenu.getMenuLevl() == 1) {
                 // 레벨이 1 인 것이 최상위 메뉴이다, OPERSYST_MENU_ID, OPER_SYST_ID 는 NULL 로 들어가 있다.
-                systMenuMap.put(systMenu.getMenuId(), systMenu.getMenuName());
+                systMenuMap.put(systMenu.getOperSystId() + "*" + systMenu.getMenuId(), systMenu.getMenuName());
             }
         }
 
         // 등록되어 있는 권한 메모리 저장
         HashMap<String, TbUserGropMenuAthr> authMap = new HashMap<>();
-        for (TbUserGropMenuAthr menuAthr : menuAuths) {
-            authMap.put(menuAthr.getGropId() + "*" + menuAthr.getMenuId(), menuAthr);
+        for (TbUserGropMenuAthr menuAthr : userGropMenuAthrList) {
+            authMap.put(menuAthr.getOperSystId() + "*" + menuAthr.getGropId() + "*" + menuAthr.getMenuId(), menuAthr);
         }
 
         // 권한별로 모든 메뉴 생성
-        for (TbUserGropInfr userGrop : userGrops) {
+        for (TbUserGropInfr userGrop : userGropInfrList) {
             if (("Y").equals(userGrop.getDelYn())) {
                 continue;
             }
 
             // 모든 메뉴에 대해서
-            for (TbOperSystMenu systMenu : systMenus) {
-//                if (!"ITSOP".equals(systMenu.getOperSystId())) {
-//                    continue;
-//                }
+            for (TbOperSystMenu systMenu : operSystMenuList) {
                 if (("Y").equals(systMenu.getDelYn()) || systMenu.getMenuLevl() == 1) {
                     // 메뉴레벨이 1인 최상위 메뉴는 제외한다.
                     continue;
                 }
 
                 // 최상위 메뉴명을 업데이트
-                systMenu.setOperSystNm(systMenuMap.get(systMenu.getParentMenuId()));
+                systMenu.setOperSystNm(systMenuMap.get(systMenu.getOperSystId() + "*" + systMenu.getParentMenuId()));
                 // 메뉴권한 등록
                 TbUserGropMenuAthrDto menuAthr = TbUserGropMenuAthr.toDtoByMenu(userGrop, systMenu);
-                TbUserGropMenuAthr auth = authMap.get(userGrop.getGropId() + "*" + systMenu.getMenuId());
+                TbUserGropMenuAthr auth = authMap.get(menuAthr.getOperSystId() + "*" + userGrop.getGropId() + "*" + systMenu.getMenuId());
                 if (auth != null) {
                     // 메뉴권한이 등록되어 있으면 업데이트
                     menuAthr.updateMenuAuth(auth);
@@ -90,7 +85,7 @@ public class TbUserGropMenuAthrService {
             //TbGropMenuAthrKey key = new TbGropMenuAthrKey(req.getGropId(), req.getOperSystMenuId());
             //Optional<TbGropMenuAthr> data = this.repo.findById(key);
             TbUserGropMenuAthr obj = req.toEntity();
-            this.repo.save(obj);
+            this.userGropMenuAthrRepo.save(obj);
             result.add(obj.toDto());
         }
 
@@ -101,22 +96,22 @@ public class TbUserGropMenuAthrService {
     @Transactional
     public TbUserGropMenuAthrDto mergeInfo(TbUserGropMenuAthrDto.TbUserGropMenuAthrUpdReq req) {
         TbUserGropMenuAthr obj = req.toEntity();
-        this.repo.save(obj);
+        this.userGropMenuAthrRepo.save(obj);
         return obj.toDto();
     }
 
-    // 정보 삭제-목록, 존재하는 데이터 만 삭제
-    @Transactional
-    public List<TbUserGropMenuAthrDto> deleteByIds(List<TbUserGropMenuAthrKey> ids) {
-        List<TbUserGropMenuAthrDto> result = new ArrayList<>();
-        for (TbUserGropMenuAthrKey id : ids) {
-            Optional<TbUserGropMenuAthr> obj = this.repo.findById(id);
-            if (obj.isPresent()) {
-                this.repo.deleteById(id);
-                result.add(obj.get().toDto());
-            }
-        }
-        return result;
-    }
+//    // 정보 삭제-목록, 존재하는 데이터 만 삭제
+//    @Transactional
+//    public List<TbUserGropMenuAthrDto> deleteByIds(List<TbUserGropMenuAthrKey> ids) {
+//        List<TbUserGropMenuAthrDto> result = new ArrayList<>();
+//        for (TbUserGropMenuAthrKey id : ids) {
+//            Optional<TbUserGropMenuAthr> obj = this.userGropMenuAthrRepo.findById(id);
+//            if (obj.isPresent()) {
+//                this.userGropMenuAthrRepo.deleteById(id);
+//                result.add(obj.get().toDto());
+//            }
+//        }
+//        return result;
+//    }
 
 }

+ 11 - 11
src/main/java/com/its/op/xnetudp/thread/CenterCommServerReceiver.java

@@ -40,11 +40,11 @@ public class CenterCommServerReceiver {
     @Async("centerCommExecutor")
     public void run(CENTER_COMM_MESSAGE data) {
         if (data == null) {
-            log.error("UDP Data Receive: CenterCommServerReceiver: RECV Data Packet NULL");
+            log.error("@@@ UDP Data Receive: CenterCommServerReceiver: RECV Data Packet NULL");
             return;
         }
 
-        log.info("UDP Data Receive: CenterCommServerReceiver: {}::{}::{}", data.getSendId(), data.getOpCode(), data.getSenderIp());
+        log.info("@@@ -UDP Data Receive: CenterCommServerReceiver: Sender[{}], OpCode[{}], SenderIp[{}]", String.format("0x%02X", data.getSendId()), String.format("0x%02X", data.getOpCode()), data.getSenderIp());
         if (CENTER_COMM_DEFINE.INT_ID_TRAFFIC_SERVER == data.getSendId()) {
             if (CENTER_COMM_DEFINE.INT_OP_TRAFFIC_CHANGE == data.getOpCode()) {
                 String prcsTm = ItsUtils.getCurrFiveMinString();
@@ -61,7 +61,7 @@ public class CenterCommServerReceiver {
                     }
                 }
 
-                log.info("@@@ RECV Traffic server job completed: {}/{}", prcsTm, currTm);
+                log.info("@@@ RECV TRF Server Message: Processing Completed, {}/{}", prcsTm, currTm);
                 // 소통정보 메모리 로딩
                 this.linkManager.loadTraf(true);
                 this.ifscManager.loadTraf(true);
@@ -79,7 +79,7 @@ public class CenterCommServerReceiver {
                     ItsWebSocketSessionManager.getInstance().sendBroadcastMessage(socketMessage.getCommand(), new TextMessage(jsonData));
                 }
                 catch(JsonProcessingException e){
-                    log.error("@@@ RECV Traffic server job completed: CenterCommServerReceiver: NotifyDto Json parsing Exception: {}", notifyDto);
+                    log.error("@@@ RECV TRF Server Message: Processing Completed, Exception: {}", notifyDto);
                 }
             }
             return;
@@ -88,7 +88,7 @@ public class CenterCommServerReceiver {
         // VMS 통신 서버는 Sender, Receiver 위치가 바뀌었음. ==> 서버 수정했음.
         //if (CENTER_COMM_DEFINE.INT_ID_VMS_OPER == data.getSendId() && CENTER_COMM_DEFINE.INT_ID_VMS_SERVER == data.getRecvId()) {
         if (CENTER_COMM_DEFINE.INT_ID_VMS_SERVER == data.getSendId()) {
-            log.info("RECV VMS Server Message: OpCode: {}, Length: {} Bytes.", data.getOpCode(), data.getLength());
+            //log.info("@@@ RECV VMS Server Message: OpCode: {}, Length: {} Bytes.", data.getOpCode(), data.getLength());
             //log.error("VMS PACKET: {}", SysUtils.byteArrayToHex(data.getBody()));
             if (data.getLength() > 0) {
                 ByteBuffer byteBuffer = ByteBuffer.wrap(data.getBody());
@@ -101,13 +101,13 @@ public class CenterCommServerReceiver {
                 //log.info("OP CODE: {}, MsgSeq: {}", opCode, msgSeq);
                 switch(opCode) {
                     case CENTER_COMM_DEFINE.INT_OP_PG_STATE_RES:
-                        log.info("RECV VMS Server Message: INT_OP_PG_STATE_RES");
+                        log.info("@@@ RECV VMS Server Message: INT_OP_PG_STATE_RES");
                         break;
                     case CENTER_COMM_DEFINE.INT_OP_VMS_FORM_SAVE:
                         byte[] saveDt  = new byte[CENTER_COMM_DEFINE.INT_VMS_MAX_DATETIME];
                         byteBuffer.get(saveDt);
                         // VMS 폼을 데이터베이스에 저장(다운로드 결과는 알수 없음)
-                        log.info("RECV VMS Server Message: INT_OP_VMS_FORM_SAVE: SaveTime: {}", new String(saveDt));
+                        log.info("@@@ RECV VMS Server Message: INT_OP_VMS_FORM_SAVE: SaveTime: {}", new String(saveDt));
                         NotifyDto notifyDto1 = NotifyDto.builder()
                                 .notify("form-save")
                                 .notifyTm(new String(saveDt))
@@ -120,13 +120,13 @@ public class CenterCommServerReceiver {
                             ItsWebSocketSessionManager.getInstance().sendBroadcastMessage(socketMessage1.getCommand(), new TextMessage(jsonData));
                         }
                         catch(JsonProcessingException e){
-                            log.error("RECV VMS Server Message: CenterCommServerReceiver: INT_OP_VMS_FORM_SAVE, NotifyDto Json parsing Exception: {}", notifyDto1);
+                            log.error("@@@ RECV VMS Server Message: CenterCommServerReceiver: INT_OP_VMS_FORM_SAVE, NotifyDto Json parsing Exception: {}", notifyDto1);
                         }
                         break;
                     case CENTER_COMM_DEFINE.INT_OP_VMS_FORM_DOWNLOAD:
                         count = byteBuffer.get();
                         // VMS 폼 다운로드 결과 데이터베이스 저장
-                        log.info("RECV VMS Server Message: INT_OP_VMS_FORM_DOWNLOAD: Count: {} EA", count);
+                        log.info("@@@ RECV VMS Server Message: INT_OP_VMS_FORM_DOWNLOAD: Count: {} EA", count);
                         NotifyDto notifyDto2 = NotifyDto.builder()
                                 .notify("form-download")
                                 .notifyTm(ItsUtils.getSysTime())
@@ -139,7 +139,7 @@ public class CenterCommServerReceiver {
                             ItsWebSocketSessionManager.getInstance().sendBroadcastMessage(socketMessage2.getCommand(), new TextMessage(jsonData));
                         }
                         catch(JsonProcessingException e){
-                            log.error("RECV VMS Server Message: CenterCommServerReceiver: INT_OP_VMS_FORM_DOWNLOAD, NotifyDto Json parsing Exception: {}", notifyDto2);
+                            log.error("@@@ RECV VMS Server Message: CenterCommServerReceiver: INT_OP_VMS_FORM_DOWNLOAD, NotifyDto Json parsing Exception: {}", notifyDto2);
                         }
 /*                        for (int ii = 0; ii < count; ii++) {
                             vmsId = new byte[CENTER_COMM_DEFINE.INT_VMS_MAX_ID];
@@ -162,7 +162,7 @@ public class CenterCommServerReceiver {
                         short normal = byteBuffer.getShort();
                         short module = byteBuffer.getShort();
                         count = byteBuffer.get();
-                        log.info("RECV VMS Server Message: INT_OP_VMS_STATE_RES: total({}), error({}), normal({}), module({}), count: {} EA.", total, error, normal, module, count);
+                        log.info("@@@ RECV VMS Server Message: INT_OP_VMS_STATE_RES: total({}), error({}), normal({}), module({}), count: {} EA.", total, error, normal, module, count);
 //                        for (int ii = 0; ii < count; ii++) {
 //                            vmsId = new byte[CENTER_COMM_DEFINE.INT_VMS_MAX_ID];
 //                            byteBuffer.get(vmsId);