Procházet zdrojové kódy

facility fail history management add

shjung před 3 roky
rodič
revize
2722565164

+ 14 - 0
src/main/java/com/its/api/its/controller/cctv/TbCctvSttsHsController.java

@@ -38,4 +38,18 @@ public class TbCctvSttsHsController {
         log.error("{}", id);
         return this.service.findAllByDateRange(FROM_DT, TO_DT, id);
     }
+
+    @ApiOperation(value = "CCTV 장애 이력 조회(TB_CCTV_STTS_HS)", response = TbCctvSttsHsDto.class, responseContainer = "ArrayList")
+    @GetMapping(value = "/stts-hs/fail", produces = {"application/json; charset=utf8"})
+    public List<TbCctvSttsHsDto> findAllFailByDateRange(
+            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
+            @RequestParam String FROM_DT,
+            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152000", required = true)
+            @RequestParam String TO_DT,
+            @ApiParam(name = "id", value = "CCTV 관리번호 목록", example = "[1,2]", required = true)
+            @RequestParam List<Long> id
+    ) {
+        log.error("{}", id);
+        return this.service.findAllFailByDateRange(FROM_DT, TO_DT, id);
+    }
 }

+ 13 - 0
src/main/java/com/its/api/its/controller/vds/TbVdsCtlrSttsHsController.java

@@ -36,4 +36,17 @@ public class TbVdsCtlrSttsHsController {
         return this.service.findAllByDateRange(FROM_DT, TO_DT, id);
     }
 
+    @ApiOperation(value = "VDS 제어기 장애 이력조회(TB_VDS_CTLR_STTS_RAW)", response = TbVdsCtlrSttsHsDto.class, responseContainer = "ArrayList")
+    @GetMapping(value = "/fail", produces = {"application/json; charset=utf8"})
+    public List<TbVdsCtlrSttsHsDto> findAllFailByDateRange(
+            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
+            @RequestParam String FROM_DT,
+            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152000", required = true)
+            @RequestParam String TO_DT,
+            @ApiParam(name = "id", value = "VDS 관리번호 목록", example = "[00000001,00000002]", required = true)
+            @RequestParam List<String> id
+    ) {
+        return this.service.findAllFailByDateRange(FROM_DT, TO_DT, id);
+    }
+
 }

+ 13 - 0
src/main/java/com/its/api/its/controller/vms/TbVmsSttsHsController.java

@@ -36,4 +36,17 @@ public class TbVmsSttsHsController {
         return this.service.findAllByDateRange(FROM_DT, TO_DT, id);
     }
 
+    @ApiOperation(value = "VMS 장애 이력 조회(TB_CCTV_STTS_HS)", response = TbVmsSttsHsDto.class, responseContainer = "ArrayList")
+    @GetMapping(value = "/fail", produces = {"application/json; charset=utf8"})
+    public List<TbVmsSttsHsDto> findAllFailByDateRange(
+            @ApiParam(name = "FROM_DT", value = "조회시작시각(YYYYMMDDHH24MI00)", example = "20210112152000", required = true)
+            @RequestParam String FROM_DT,
+            @ApiParam(name = "TO_DT", value = "조회종료시각(YYYYMMDDHH24MI59)", example = "20221112152000", required = true)
+            @RequestParam String TO_DT,
+            @ApiParam(name = "id", value = "VMS 관리번호 목록", example = "[10014,10015]", required = true)
+            @RequestParam List<Long> id
+    ) {
+        return this.service.findAllFailByDateRange(FROM_DT, TO_DT, id);
+    }
+
 }

+ 5 - 0
src/main/java/com/its/api/its/repository/cctv/TbCctvSttsHsRepository.java

@@ -23,4 +23,9 @@ public interface TbCctvSttsHsRepository extends JpaRepository<TbCctvSttsHs, TbCc
            " group by p.cctvMngmNmbr")
     List<SttsHsErrCntInf> findAllCommErrorCount(String fromDt);
 
+    @Query("select p from TbCctvSttsHs p inner join fetch p.cctv " +
+           " where p.crtnDt between :fromDt and :toDt " +
+           "   and p.cmncSttsCd <> 'CMS0' " +
+           "   and p.cctvMngmNmbr in :ids")
+    List<TbCctvSttsHs> findAllFailByDateRange(String fromDt, String toDt, List<Long> ids);
 }

+ 5 - 0
src/main/java/com/its/api/its/repository/vds/TbVdsCtlrSttsHsRepository.java

@@ -23,4 +23,9 @@ public interface TbVdsCtlrSttsHsRepository extends JpaRepository<TbVdsCtlrSttsHs
             " group by p.ctlrMngmNmbr")
     List<SttsHsErrCntInf> findAllCommErrorCount(String fromDt);
 
+    @Query("select p from TbVdsCtlrSttsHs p inner join fetch p.vds " +
+           " where p.ocrrDt between :fromDt and :toDt " +
+           "   and (p.cmncSttsCd <> 'CMS0' or p.cboxDoorSttsCd <> 'CDS0' or p.cboxTmpr > 40)" +
+           "   and p.ctlrMngmNmbr in :ids")
+    List<TbVdsCtlrSttsHs> findAllFailByDateRange(String fromDt, String toDt, List<String> ids);
 }

+ 6 - 0
src/main/java/com/its/api/its/repository/vms/TbVmsSttsHsRepository.java

@@ -22,4 +22,10 @@ public interface TbVmsSttsHsRepository extends JpaRepository<TbVmsSttsHs, TbVmsS
             "   and p.connSttsCd <> 'CMS0' " +
             " group by p.vmsCtlrNmbr")
     List<SttsHsErrCntInf> findAllCommErrorCount(String fromDt);
+
+    @Query("select p from TbVmsSttsHs p inner join fetch p.vms " +
+           " where p.rgstDt between :fromDt and :toDt " +
+           "   and (p.connSttsCd <> 'CMS0' or p.cboxdoorOpenSttsCd <> 'CDS0' or p.cboxTmpr > 40)" +
+           "   and p.vmsCtlrNmbr in :ids")
+    List<TbVmsSttsHs> findAllFailByDateRange(String fromDt, String toDt, List<Long> ids);
 }

+ 28 - 1
src/main/java/com/its/api/its/service/cctv/TbCctvSttsHsService.java

@@ -44,7 +44,13 @@ public class TbCctvSttsHsService {
         return entity.toDto();
     }
 
-    // 이력 데이터 조회
+    /**
+     * 상태 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
     @Transactional(readOnly = true)
     public List<TbCctvSttsHsDto> findAllByDateRange(String fromDt, String toDt, List<Long> ids) {
 
@@ -60,4 +66,25 @@ public class TbCctvSttsHsService {
         return result;
     }
 
+    /**
+     * 장애 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public List<TbCctvSttsHsDto> findAllFailByDateRange(String fromDt, String toDt, List<Long> ids) {
+
+        List<TbCctvSttsHsDto> result = new ArrayList<>();
+        List<TbCctvSttsHs> data = this.repo.findAllFailByDateRange(fromDt, toDt, ids);
+        if (data != null) {
+            data.forEach(obj -> {
+                if (obj.getCctv() != null && ("N").equals(obj.getCctv().getDelYn())) {
+                    result.add(obj.toDto());
+                }
+            });
+        }
+        return result;
+    }
 }

+ 29 - 0
src/main/java/com/its/api/its/service/vds/TbVdsCtlrSttsHsService.java

@@ -44,6 +44,14 @@ public class TbVdsCtlrSttsHsService {
         return entity.toDto();
     }
 
+    /**
+     * 상태 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
+    @Transactional(readOnly = true)
     public List<TbVdsCtlrSttsHsDto> findAllByDateRange(String fromDt, String toDt, List<String> ids) {
         List<TbVdsCtlrSttsHsDto> result = new ArrayList<>();
         List<TbVdsCtlrSttsHs> data = this.repo.findAllByDateRange(fromDt, toDt, ids);
@@ -56,4 +64,25 @@ public class TbVdsCtlrSttsHsService {
         }
         return result;
     }
+
+    /**
+     * 장애 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public List<TbVdsCtlrSttsHsDto> findAllFailByDateRange(String fromDt, String toDt, List<String> ids) {
+        List<TbVdsCtlrSttsHsDto> result = new ArrayList<>();
+        List<TbVdsCtlrSttsHs> data = this.repo.findAllFailByDateRange(fromDt, toDt, ids);
+        if (data != null) {
+            data.forEach(obj -> {
+                if (obj.getVds() != null && ("N").equals(obj.getVds().getDelYn())) {
+                    result.add(obj.toDto());
+                }
+            });
+        }
+        return result;
+    }
 }

+ 30 - 0
src/main/java/com/its/api/its/service/vms/TbVmsSttsHsService.java

@@ -44,6 +44,14 @@ public class TbVmsSttsHsService {
         return entity.toDto();
     }
 
+    /**
+     * 상태 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
+    @Transactional(readOnly = true)
     public List<TbVmsSttsHsDto> findAllByDateRange(String fromDt, String toDt, List<Long> ids) {
 
         List<TbVmsSttsHsDto> result = new ArrayList<>();
@@ -57,4 +65,26 @@ public class TbVmsSttsHsService {
         }
         return result;
     }
+
+    /**
+     * 장애 이력 조회
+     * @param fromDt
+     * @param toDt
+     * @param ids
+     * @return
+     */
+    @Transactional(readOnly = true)
+    public List<TbVmsSttsHsDto> findAllFailByDateRange(String fromDt, String toDt, List<Long> ids) {
+
+        List<TbVmsSttsHsDto> result = new ArrayList<>();
+        List<TbVmsSttsHs> data = this.repo.findAllFailByDateRange(fromDt, toDt, ids);
+        if (data != null) {
+            data.forEach(obj -> {
+                if (obj.getVms() != null && ("N").equals(obj.getVms().getDelYn())) {
+                    result.add(obj.toDto());
+                }
+            });
+        }
+        return result;
+    }
 }