shjung před 2 roky
rodič
revize
74d20114a9

+ 3 - 1
src/main/java/com/its/cctv/CctvCommServerApplication.java

@@ -29,6 +29,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.context.event.ContextClosedEvent;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.web.bind.annotation.CrossOrigin;
 
 import javax.swing.*;
 import java.awt.*;
@@ -46,6 +47,7 @@ import java.nio.charset.Charset;
 @Configuration
 @SpringBootApplication
 @ComponentScan(basePackages = {"com.its.cctv.config", "com.its.cctv.dao.mapper", "com.its"})
+@CrossOrigin("*")
 public class CctvCommServerApplication implements CommandLineRunner, ApplicationListener<ContextClosedEvent>, InitializingBean, DisposableBean {
 //public class CctvCommServerApplication implements ApplicationListener<ContextClosedEvent>, InitializingBean, DisposableBean {
 
@@ -117,7 +119,7 @@ public class CctvCommServerApplication implements CommandLineRunner, Application
                 frame.addWindowListener(new WindowAdapter() {
                     @Override
                     public void windowClosing(WindowEvent e) {
-                        if (JOptionPane.showConfirmDialog(UI.getRootPanel(), "시스템을 종료 하시겠습니까?", "시스템 종료", 0) == 0) {
+                        if (JOptionPane.showConfirmDialog(UI.getRootPanel(), "CCTV 통신 서버 시스템을 종료 하시겠습니까?", "시스템 종료", 0) == 0) {
                             System.exit(0);
                         } else {
                             frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

+ 12 - 6
src/main/java/com/its/cctv/api/controller/CctvControlController.java

@@ -39,7 +39,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV 환경 파라미터 설정", response = CctvParamControlDto.CctvParamControlRes.class)
-    @PostMapping(value = "/param-set/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/param-set/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/param-set/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvParamControlDto.CctvParamControlRes controlParam(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,
@@ -65,7 +66,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV PTZ 제어", response = CctvPtzControlDto.CctvPtzControlRes.class)
-    @PostMapping(value = "/ptz/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/ptz/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/ptz/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvPtzControlDto.CctvPtzControlRes controlPtz(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,
@@ -75,7 +77,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV Preset 제어", response = CctvPresetControlDto.CctvPresetControlRes.class)
-    @PostMapping(value = "/preset/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/preset/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/preset/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvPresetControlDto.CctvPresetControlRes controlPreset(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,
@@ -85,7 +88,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV 가변 문자 설정", response = CctvVarCharControlDto.CctvVarCharControlRes.class)
-    @PostMapping(value = "/var-char-set/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/var-char-set/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/var-char-set/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvVarCharControlDto.CctvVarCharControlRes controlVarCharSet(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,
@@ -95,7 +99,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV 가변 문자 삭제", response = CctvVarCharControlDto.CctvVarCharControlRes.class)
-    @PostMapping(value = "/var-char-del/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/var-char-del/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/var-char-del/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvVarCharControlDto.CctvVarCharControlRes controlVarCharDel(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,
@@ -105,7 +110,8 @@ public class CctvControlController {
     }
 
     @ApiOperation(value = "CCTV RESET", response = CctvControlDto.CctvControlResetRes.class)
-    @PostMapping(value = "/reset/{id}", produces = {"application/json; charset=utf8"})
+    //@PostMapping(value = "/reset/{id}", produces = {"application/json; charset=utf8"})
+    @RequestMapping(value = "/reset/{id}", method = {RequestMethod.GET, RequestMethod.POST})
     public CctvControlDto.CctvControlResetRes controlReset(
             @ApiParam(name = "id", value = "제어기번호", example = "1001", required = true)
             @PathVariable("id") Long id,

+ 43 - 24
src/main/java/com/its/cctv/api/dto/TbCctvCtlrSttsDto.java

@@ -78,28 +78,47 @@ public class TbCctvCtlrSttsDto implements Serializable {
     private Integer focus;
 
     // Code Description Field
-    @ApiModelProperty("통신 상태 코드 설명")
-    @JsonProperty("cmnc_stts_desc")    // CMNC_STTS_CD
-    private String cmncSttsDesc;
-
-    @ApiModelProperty("함체 문 상태 코드('CDS')-앞문/뒷문상태가 모두닫힌경우 닫힘 설명")
-    @JsonProperty("cbox_door_stts_desc")    // CBOX_DOOR_STTS_CD
-    private String cboxDoorSttsDesc;
-
-    @ApiModelProperty("앞문 상태 코드('CDS') 설명")
-    @JsonProperty("front_door_stts_desc")    // FRONT_DOOR_STTS_CD
-    private String frontDoorSttsDesc;
-
-    @ApiModelProperty("뒷문 상태 코드('CDS') 설명")
-    @JsonProperty("back_door_stts_desc")    // BACK_DOOR_STTS_CD
-    private String backDoorSttsDesc;
-
-    @ApiModelProperty("팬 상태 코드('PAS') 설명")
-    @JsonProperty("fan_stts_desc")    // FAN_STTS_CD
-    private String fanSttsDesc;
-
-    @ApiModelProperty("히터 상태 코드('HTS') 설명")
-    @JsonProperty("hetr_stts_desc")    // HETR_STTS_CD
-    private String hetrSttsDesc;
-
+//    @ApiModelProperty("통신 상태 코드 설명")
+//    @JsonProperty("cmnc_stts_desc")    // CMNC_STTS_CD
+//    private String cmncSttsDesc;
+//
+//    @ApiModelProperty("함체 문 상태 코드('CDS')-앞문/뒷문상태가 모두닫힌경우 닫힘 설명")
+//    @JsonProperty("cbox_door_stts_desc")    // CBOX_DOOR_STTS_CD
+//    private String cboxDoorSttsDesc;
+//
+//    @ApiModelProperty("앞문 상태 코드('CDS') 설명")
+//    @JsonProperty("front_door_stts_desc")    // FRONT_DOOR_STTS_CD
+//    private String frontDoorSttsDesc;
+//
+//    @ApiModelProperty("뒷문 상태 코드('CDS') 설명")
+//    @JsonProperty("back_door_stts_desc")    // BACK_DOOR_STTS_CD
+//    private String backDoorSttsDesc;
+//
+//    @ApiModelProperty("팬 상태 코드('PAS') 설명")
+//    @JsonProperty("fan_stts_desc")    // FAN_STTS_CD
+//    private String fanSttsDesc;
+//
+//    @ApiModelProperty("히터 상태 코드('HTS') 설명")
+//    @JsonProperty("hetr_stts_desc")    // HETR_STTS_CD
+//    private String hetrSttsDesc;
+//
+//    @ApiModelProperty("VIDEO INPUT 상태 코드('VDI') 설명")
+//    @JsonProperty("video_input_desc")    // HETR_STTS_CD
+//    private String videoInputDesc;
+//
+//    @ApiModelProperty("CCTV 제어기 ID")  // Y VARCHAR(30)
+//    @JsonProperty("cctv_ctlr_id")
+//    private String cctvCtlrId;
+//
+//    @ApiModelProperty("설치 위치 명")  // Y VARCHAR(40)
+//    @JsonProperty("istl_lctn_nm")
+//    private String istlLctnNm;
+//
+//    @ApiModelProperty("상태정보 결측 여부")
+//    @JsonProperty("miss_stts_yn")
+//    private String missSttsYn;
+//
+//    @ApiModelProperty("수집건수")
+//    @JsonProperty("coll_cnt")
+//    private Integer collCnt;
 }

+ 25 - 19
src/main/java/com/its/cctv/api/service/CctvControlService.java

@@ -1,6 +1,5 @@
 package com.its.cctv.api.service;
 
-import com.its.app.utils.ByteUtils;
 import com.its.cctv.api.dto.*;
 import com.its.cctv.domain.NET;
 import com.its.cctv.entity.TbCctvCtlr;
@@ -78,6 +77,7 @@ public class CctvControlService {
      * @return
      */
     public CctvStatusDto.CctvStatusDtoRes requestStatus(Long id) {
+        log.info("requestStatus: {}", id);
         TbCctvCtlr cctv = this.requireOne(id);
         if (cctv == null) {
             return new CctvStatusDto.CctvStatusDtoRes(1, "알수없는 CCTV 관리번호 입니다.", null);
@@ -96,7 +96,7 @@ public class CctvControlService {
      * @return
      */
     public CctvPtzControlDto.CctvPtzControlRes controlPtz(Long id, CctvPtzControlDto.CctvControlPtzReq req) {
-        log.info("controlPtz: {}", req);
+        log.info("controlPtz: {}, {}", id, req);
         TbCctvCtlr cctv = this.requireOne(id);
         if (cctv == null) {
             return new CctvPtzControlDto.CctvPtzControlRes(req.getCommand(), req.getAction(), 1, "알수없는 CCTV 관리번호 입니다.");
@@ -124,23 +124,23 @@ public class CctvControlService {
             byte focusSped = (byte)Math.min(command.getFocusSped(), speed);
             CctvReqPtzCtrl pkt = new CctvReqPtzCtrl(cctv.getAddress());
             byte ptz = pkt.setPtzValue((byte) pan, (byte) tilt, (byte) zoom, (byte) focus, (byte) panSped, (byte) tiltSped, (byte) zoomSped, (byte) focusSped);
-            log.info("PTZ Control: " + ByteUtils.byteToBitString(ptz));
+            //log.info("[{}]. PTZ Control: " + ByteUtils.byteToBitString(ptz));
             ByteBuffer sendBuffer = pkt.getByteBuffer();
             if (cctv.sendData(sendBuffer, 0, "cctv_PtzStart")) {
-                log.info("{} send success.", cmdDesc);
+                log.info("[{}]. START send success. {}", cctv.getCCTV_CTLR_ID(), cmdDesc);
             } else {
                 result.setResult(4, "CCTV PTZ 시작 명령 전송이 실패하였습니다.");
-                log.error("{} send failed.", cmdDesc);
+                log.error("[{}]. START send failed. {}", cctv.getCCTV_CTLR_ID(), cmdDesc);
             }
         } else {
             // stop
             CctvReqPtzCtrl pkt = new CctvReqPtzCtrl(cctv.getAddress());
             ByteBuffer sendBuffer = pkt.getByteBuffer();
             if (cctv.sendData(sendBuffer, 0, "cctv_PtzStop")) {
-                log.info("{} STOP send success.", cmdDesc);
+                log.info("[{}]. STOP send success. {}", cctv.getCCTV_CTLR_ID(), cmdDesc);
             } else {
                 result.setResult(4, "CCTV PTZ 정지 명령 전송이 실패하였습니다.");
-                log.error("{} STOP send failed.", cmdDesc);
+                log.error("[{}]. STOP send failed. {}", cctv.getCCTV_CTLR_ID(), cmdDesc);
             }
         }
         return result;
@@ -167,10 +167,10 @@ public class CctvControlService {
         pkt.setValue(req.getPan().shortValue(), req.getTilt().shortValue(), req.getZoom().shortValue(), req.getFocus().shortValue());
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (cctv.sendData(sendBuffer, 0, "cctv_PresetMove")) {
-            log.info("PRESET send success.");
+            log.info("[{}]. PRESET send success.", cctv.getCCTV_CTLR_ID());
         } else {
             result.setResult(4, "CCTV PRESET 명령 전송이 실패하였습니다.");
-            log.error("PRESET send failed.");
+            log.error("[{}]. PRESET send failed.", cctv.getCCTV_CTLR_ID());
         }
         return result;
     }
@@ -196,10 +196,10 @@ public class CctvControlService {
         pkt.setValue(req.getFanOnTmpr().byteValue(), req.getFanOffTmpr().byteValue(), req.getHetrOnTmpr().byteValue(), req.getHetrOffTmpr().byteValue());
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (cctv.sendData(sendBuffer, 0, "cctv_ParamSet")) {
-            log.info("PARAMETER SET send success.");
+            log.info("[{}]. PARAMETER SET send success.", cctv.getCCTV_CTLR_ID());
         } else {
             result.setResult(4, "CCTV PARAMETER 명령 전송이 실패하였습니다.");
-            log.error("PARAMETER SET send failed.");
+            log.error("[{}]. PARAMETER SET send failed.", cctv.getCCTV_CTLR_ID());
         }
         return result;
     }
@@ -227,7 +227,7 @@ public class CctvControlService {
                 cctv.getParamVal().setCompleted(false);
                 ByteBuffer sendBuffer = cctv.getReqParam().getByteBuffer();
                 if (cctv.sendData(sendBuffer, 0, "cctv_ParamReq")) {
-                    log.info("PARAMETER QRY send success.");
+                    log.info("[{}]. PARAMETER QRY send success.", cctv.getCCTV_CTLR_ID());
                     cctv.getParamVal().wait(5000);
                     if (cctv.getParamVal().isCompleted()) {
                         result.setValue(cctv.getParamVal().getFanOnTmpr(), cctv.getParamVal().getFanOffTmpr(), cctv.getParamVal().getHetrOnTmpr(), cctv.getParamVal().getHetrOffTmpr());
@@ -236,10 +236,11 @@ public class CctvControlService {
                     }
                 } else {
                     result.setResult(4, "CCTV PARAMETER 값조회 명령 전송이 실패하였습니다.");
-                    log.error("PARAMETER QRY send failed.");
+                    log.error("[{}]. PARAMETER QRY send failed.", cctv.getCCTV_CTLR_ID());
                 }
             } catch (InterruptedException e) {
                 result.setResult(9, "CCTV PARAMETER 값조회 명령 전송 중 오류가 발생하였습니다.");
+                log.error("[{}]. PARAMETER QRY send failed. InterruptedException.", cctv.getCCTV_CTLR_ID());
             }
             cctv.getParamVal().setRequest(false);
         }
@@ -272,7 +273,7 @@ public class CctvControlService {
 //                if (cctv.sendData(sendBuffer, 0, "cctv_PresetQry")) {
                 ByteBuffer sendBuffer = cctv.getReqState().getByteBuffer();
                 if (cctv.sendData(sendBuffer, 0, "cctv_PresetQry")) {
-                    log.info("PRESET QRY send success.");
+                    log.info("[{}]. PRESET QRY send success.", cctv.getCCTV_CTLR_ID());
                     cctv.getPsetVal().wait(5000);
                     if (cctv.getPsetVal().isCompleted()) {
                         result.setValue(cctv.getPsetVal().getPan(), cctv.getPsetVal().getTilt(), cctv.getPsetVal().getZoom(), cctv.getPsetVal().getFocus());
@@ -281,10 +282,11 @@ public class CctvControlService {
                     }
                 } else {
                     result.setResult(4, "CCTV PRESET 값조회 명령 전송이 실패하였습니다.");
-                    log.error("PRESET QRY send failed.");
+                    log.error("[{}]. PRESET QRY send failed.", cctv.getCCTV_CTLR_ID());
                 }
             } catch (InterruptedException e) {
                 result.setResult(6, "CCTV PRESET 값조회 명령 전송 중 오류가 발생하였습니다.");
+                log.error("[{}]. PRESET QRY send failed. InterruptedException.", cctv.getCCTV_CTLR_ID());
             }
             cctv.getPsetVal().setRequest(false);
         }
@@ -348,10 +350,10 @@ public class CctvControlService {
 
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (cctv.sendData(sendBuffer, 0, "cctv_CharVarSet")) {
-            log.info("CHAR-VAR-SET send success.");
+            log.info("[{}]. CHAR-VAR-SET send success.", cctv.getCCTV_CTLR_ID());
         } else {
             result.setResult(4, "CCTV CHAR-VAR-SET 명령 전송이 실패하였습니다.");
-            log.error("CHAR-VAR-SET send failed.");
+            log.error("[{}]. CHAR-VAR-SET send failed.", cctv.getCCTV_CTLR_ID());
         }
         return result;
     }
@@ -378,10 +380,10 @@ public class CctvControlService {
 
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (cctv.sendData(sendBuffer, 0, "cctv_CharVarDel")) {
-            log.info("CHAR-VAR-DEL send success.");
+            log.info("[{}]. CHAR-VAR-DEL send success.", cctv.getCCTV_CTLR_ID());
         } else {
             result.setResult(4, "CCTV CHAR-VAR-DEL 명령 전송이 실패하였습니다.");
-            log.error("CHAR-VAR-DEL send failed.");
+            log.error("[{}]. CHAR-VAR-DEL send failed.", cctv.getCCTV_CTLR_ID());
         }
         return result;
     }
@@ -407,12 +409,16 @@ public class CctvControlService {
             // SW Reset
             if (!cctv.resetSw()) {
                 result.setResult(4, "CCTV 제어기 SW 리셋 명령 전송에 실패하였습니다.");
+            } else {
+                log.info("[{}]. SW Reset send success.", cctv.getCCTV_CTLR_ID());
             }
         }
         else if (1 == req.getResetType()) {
             // HW Reset
             if (!cctv.resetHw()) {
                 result.setResult(5, "CCTV 제어기 HW 리셋 명령 전송에 실패하였습니다.");
+            } else {
+                log.info("[{}]. HW Reset send success.", cctv.getCCTV_CTLR_ID());
             }
         }
         else {

+ 9 - 1
src/main/java/com/its/cctv/config/DebugConfig.java

@@ -16,10 +16,14 @@ import java.util.Properties;
 public class DebugConfig {
 
     private boolean sttsLog;
+    private boolean dumpRecv;
+    private boolean dumpSend;
 
     @PostConstruct
     void init() {
         this.sttsLog = true;
+        this.dumpRecv = false;
+        this.dumpSend = false;
         load();
     }
 
@@ -40,8 +44,12 @@ public class DebugConfig {
             props.load(in);
             in.close();
 
-            String ptzControl = props.getProperty("stts",  "N").trim().toUpperCase();
+            String ptzControl = props.getProperty("stts-log",  "N").trim().toUpperCase();
             this.sttsLog = "Y".equals(ptzControl);
+            String dumpRecv = props.getProperty("dump-recv",  "N").trim().toUpperCase();
+            this.dumpRecv = "Y".equals(dumpRecv);
+            String dumpSend = props.getProperty("dump-send",  "N").trim().toUpperCase();
+            this.dumpSend = "Y".equals(dumpSend);
         }
         catch(Exception e) {
             log.error("{}.load: Exception: {}", this.getClass().getSimpleName(), e.toString());

+ 6 - 6
src/main/java/com/its/cctv/entity/TbCctvCtlr.java

@@ -200,33 +200,33 @@ public class TbCctvCtlr {
 
 	public boolean resetHw() {
 		if (getChannel() == null || getNetState() == NET.CLOSED) {
-			log.error("Hardware Reset Request: channel not connected: [{}]", this);
+			log.error("[{}]. Hardware Reset Request: channel not connected.", this.CCTV_CTLR_ID);
 			return false;
 		}
 		CctvReqResetHw req = new CctvReqResetHw(getAddress());
 		req.makeCRC();
 		ByteBuffer sendBuffer = req.getByteBuffer();
 		if (!sendData(sendBuffer, 0, "cctv_ResetHw")) {
-			log.error("Hardware Reset Data Send Failed: [{}]", this);
+			log.error("[{}]. Hardware Reset Data Send Failed.", this);
 			return false;
 		}
-		log.error("Hardware Reset Data Send Failed: [{}]", this);
+		log.error("[{}]. Hardware Reset Data Send Failed.", this);
 		return true;
 	}
 
 	public boolean resetSw() {
 		if (getChannel() == null || getNetState() == NET.CLOSED) {
-			log.error("Software Reset Request: channel not connected: [{}]", this);
+			log.error("[{}]. Software Reset Request: channel not connected.", this.CCTV_CTLR_ID);
 			return false;
 		}
 		CctvReqResetHw req = new CctvReqResetHw(getAddress());
 		req.makeCRC();
 		ByteBuffer sendBuffer = req.getByteBuffer();
 		if (!sendData(sendBuffer, 0, "cctv_ResetSw")) {
-			log.error("Software Reset Data Send Failed: [{}]", this);
+			log.error("[{}]. Software Reset Data Send Failed.", this.CCTV_CTLR_ID);
 			return false;
 		}
-		log.error("Software Reset Data Send Failed: [{}]", this);
+		log.error("[{}]. Software Reset Data Send Failed.", this.CCTV_CTLR_ID);
 		return true;
 	}
 

+ 4 - 0
src/main/java/com/its/cctv/ui/MainUI.java

@@ -154,6 +154,10 @@ public class MainUI {
             public void actionPerformed(ActionEvent e) {
                 Runtime rt = Runtime.getRuntime();
                 try {
+                    if (debugConfig != null) {
+                        debugConfig.load();
+                        chkPtzControl.setSelected(debugConfig.isSttsLog());
+                    }
                     rt.exec("explorer.exe logs");
                 } catch (IOException ex) {
                     throw new RuntimeException(ex);

+ 6 - 6
src/main/java/com/its/cctv/ui/SubUI.java

@@ -3,7 +3,6 @@ package com.its.cctv.ui;
 import com.intellij.uiDesigner.core.GridConstraints;
 import com.intellij.uiDesigner.core.GridLayoutManager;
 import com.intellij.uiDesigner.core.Spacer;
-import com.its.app.utils.ByteUtils;
 import com.its.cctv.entity.TbCctvCtlr;
 import com.its.cctv.entity.TbCctvCtlrStts;
 import com.its.cctv.service.CctvCtlrService;
@@ -292,9 +291,9 @@ public abstract class SubUI {
         CctvReqPtzCtrl pkt = new CctvReqPtzCtrl(this.selObj.getAddress());
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (this.selObj.sendData(sendBuffer, 0, "cctv_PtzStop")) {
-            logging("STOP Command send success.");
+            logging("STOP Command send success." + this.selObj.getCCTV_CTLR_IP());
         } else {
-            logging("STOP Command send failed.");
+            logging("STOP Command send failed." + this.selObj.getCCTV_CTLR_IP());
         }
     }
 
@@ -319,17 +318,18 @@ public abstract class SubUI {
         // focus, 0: Stop, 1: Near, 2: Far,   bit6 ~ bit7
         CctvReqPtzCtrl pkt = new CctvReqPtzCtrl(this.selObj.getAddress());
         byte ptz = pkt.setPtzValue((byte) pan, (byte) tilt, (byte) zoom, (byte) focus, (byte) panSped, (byte) tiltSped, (byte) zoomSped, (byte) focusSped);
-        logging("PTZ Control: " + ByteUtils.byteToBitString(ptz));
+        //logging("PTZ Control: " + ByteUtils.byteToBitString(ptz));
         ByteBuffer sendBuffer = pkt.getByteBuffer();
         if (this.selObj.sendData(sendBuffer, 0, "cctv_PtzStart")) {
-            logging(cmd + " send success.");
+            logging(cmd + " send success." + this.selObj.getCCTV_CTLR_IP());
         } else {
-            logging(cmd + " send failed.");
+            logging(cmd + " send failed." + this.selObj.getCCTV_CTLR_IP());
         }
     }
 
     public void updateInfo(TbCctvCtlr selObj) {
         this.selObj = selObj;
+        taLog.setText(null);
         txtNmbr.setText("");
         txtName.setText("");
         txtState.setText("");

+ 30 - 38
src/main/java/com/its/cctv/webapp/config/WebSecurityConfig.java

@@ -5,7 +5,6 @@ import com.its.cctv.webapp.service.UserService;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.http.HttpMethod;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
 import org.springframework.security.config.annotation.web.builders.WebSecurity;
 import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
@@ -13,7 +12,9 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
 import org.springframework.security.config.http.SessionCreationPolicy;
 import org.springframework.security.core.session.SessionRegistry;
 import org.springframework.security.core.session.SessionRegistryImpl;
-import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
+import org.springframework.web.cors.CorsConfiguration;
+import org.springframework.web.cors.CorsConfigurationSource;
+import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
 
 import javax.servlet.http.HttpSessionListener;
 
@@ -29,7 +30,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Override
     public void configure(WebSecurity web) throws Exception {
         web.ignoring().antMatchers("/favicon.ico");
-        web.ignoring().antMatchers(new String[]{"/css/**", "/js/**", "/img/**", "/lib/**"});
+        web.ignoring().antMatchers("/css/**", "/js/**", "/img/**", "/lib/**");
 
         web.ignoring().antMatchers(HttpMethod.GET, "/api/**");  // GET Method 는 모두 통과
         web.ignoring().antMatchers(HttpMethod.POST, "/api/**");  // GET Method 는 모두 통과
@@ -40,51 +41,42 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
     @Override
     protected void configure(HttpSecurity http) throws Exception {
 
-        http.authorizeRequests()
+        http
+                .httpBasic().disable()
+                .cors().configurationSource(corsConfigurationSource())
+                .and()
+                .csrf().disable()
+                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
+                .and()
+                .authorizeRequests()
                 // SWAGGER 권한 설정
                 .antMatchers("/swagger-ui.html", "/swagger/**", "/swagger-resources/**", "/webjars/**", "/v2/api-docs").permitAll()
                 // 웹소켓 권한 설정하지
                 .antMatchers("/ws/**").permitAll()
                 .antMatchers("/api/**").permitAll()
-                .antMatchers(new String[]{"/index"})
-                .hasRole("ADMIN")
-                .antMatchers(new String[]{"/**"})
-                .hasRole("ADMIN")
-                .and()
-                .formLogin()
-                .loginPage("/login")
-                .defaultSuccessUrl("/index")
-                .failureUrl("/denied")
-                .permitAll()
-                .and()
-                .logout()
-                .logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
-                .logoutSuccessUrl("/login").invalidateHttpSession(true)
-                .deleteCookies()
-                .and()
-                .exceptionHandling()
-                .accessDeniedPage("/denied");
+                .anyRequest().permitAll()
+        ;
+    }
 
-        http
-                .csrf()
-                .disable();
+    // CORS 허용 적용
+    @Bean
+    public CorsConfigurationSource corsConfigurationSource() {
+        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        CorsConfiguration corsConfig = new CorsConfiguration();
 
-        http
-                .sessionManagement()
-                .sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
-                .invalidSessionUrl("/login")
-                .sessionFixation()
-                .migrateSession()
-                .maximumSessions(5)
-                .maxSessionsPreventsLogin(true)
-                .expiredUrl("/login")
-                .sessionRegistry(this.sessionRegistry());
-    }
+        corsConfig.setAllowCredentials(true);
+        corsConfig.addAllowedOriginPattern("*"); // addAllowedOrigin("*") 대신 사용
+        corsConfig.addAllowedHeader("*");
+        corsConfig.addAllowedMethod("*");
+        source.registerCorsConfiguration("/**", corsConfig);
 
-    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-        auth.userDetailsService(this.userService);
+        return source;
     }
 
+//    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
+//        auth.userDetailsService(this.userService);
+//    }
+
     @Bean
     public SessionRegistry sessionRegistry() {
         return new SessionRegistryImpl();

+ 9 - 3
src/main/java/com/its/cctv/xnettcp/cctv/CctvTcpClient.java

@@ -76,7 +76,9 @@ public class CctvTcpClient implements Callable<Object> {
             });
         }
 
-        log.info("[{}]. Controller try connect: {}, {}", this.controller.getCCTV_CTLR_ID(), this.ipAddress, this.port);
+        if (this.controller.getDebugConfig() != null && this.controller.getDebugConfig().isSttsLog()) {
+            log.info("[{}]. Controller try connect: {}, {}", this.controller.getCCTV_CTLR_ID(), this.ipAddress, this.port);
+        }
         if (this.channelFuture != null && this.channelFuture.channel() != null) {
             this.channelFuture.channel().close();
             this.channelFuture = null;
@@ -90,7 +92,9 @@ public class CctvTcpClient implements Callable<Object> {
                     //log.info("[{}]. Controller Channel open");
                     channelOpen(future.channel());
                 } else {
-                    log.error("[{}]. Controller connect Failed: {}", controller.getCCTV_CTLR_ID(), future.cause().getMessage());
+                    if (controller.getDebugConfig() != null && controller.getDebugConfig().isSttsLog()) {
+                        log.error("[{}]. Controller connect Failed: {}", controller.getCCTV_CTLR_ID(), future.cause().getMessage());
+                    }
                 }
             }
         });
@@ -110,7 +114,9 @@ public class CctvTcpClient implements Callable<Object> {
      * @param channel
      */
     protected void channelOpen(Channel channel) {
-        log.info("[{}]. Controller connected: channel {}", this.controller.getCCTV_CTLR_ID(), channel);
+        if (this.controller.getDebugConfig() != null && this.controller.getDebugConfig().isSttsLog()) {
+            log.info("[{}]. Controller connected: channel {}", this.controller.getCCTV_CTLR_ID(), channel);
+        }
         TbCctvCtlr obj = this.controller;
         obj.channelOpen(channel);
 

+ 1 - 1
src/main/java/com/its/cctv/xnettcp/cctv/codec/CctvTcpClientDecoder.java

@@ -46,7 +46,7 @@ public class CctvTcpClientDecoder extends ByteToMessageDecoder {
             int readableBytes = byteBuf.readableBytes();
             //log.info("[{}]. RECV: ReadableBytes: {} Bytes, ReaderIndex: {}", obj.getCCTV_CTLR_ID(), readableBytes, byteBuf.readerIndex());
 
-            if (obj.isDump()) {
+            if (obj.getDebugConfig() != null && obj.getDebugConfig().isDumpRecv()) {
                 byte[] debugBytes = new byte[byteBuf.readableBytes()];
                 byteBuf.getBytes(byteBuf.readerIndex(), debugBytes);
                 log.info("[{}]. RECV: {} Bytes. {}", obj.getCCTV_CTLR_ID(), debugBytes.length, SysUtils.byteArrayToHex(debugBytes));

+ 1 - 1
src/main/java/com/its/cctv/xnettcp/cctv/codec/CctvTcpClientEncoder.java

@@ -60,7 +60,7 @@ public class CctvTcpClientEncoder extends MessageToByteEncoder<Object> {
 //                log.info("[{}]. SEND: {}, {} Bytes.", obj.getCCTV_CTLR_ID(), opCodeDesc, sendBytes.length);
 //            }
 //        }
-        if (obj.isDump()) {
+        if (obj.getDebugConfig() != null && obj.getDebugConfig().isDumpSend()) {
             log.info("[{}]. SEND: {}, {} Bytes. {}", obj.getCCTV_CTLR_ID(), CctvProtocol.getOpCodeName(sendBytes[CctvReqFrameHead.OPCODE_POS]), sendBytes.length, SysUtils.byteArrayToHex(sendBytes));
         }