|
@@ -1,15 +1,18 @@
|
|
package com.its.api.its.service.statistics;
|
|
package com.its.api.its.service.statistics;
|
|
|
|
|
|
-import com.its.api.its.model.dto.statistics.FcltSttsStatDto;
|
|
|
|
|
|
+import com.its.api.its.model.dto.statistics.FcltSttsStatErrorDto;
|
|
|
|
+import com.its.api.its.model.dto.statistics.FcltSttsStatErrorInf;
|
|
import com.its.api.its.model.dto.statistics.FcltSttsStatTypeDto;
|
|
import com.its.api.its.model.dto.statistics.FcltSttsStatTypeDto;
|
|
-import com.its.api.its.repository.statistics.FcltSttsStatisticsMapper;
|
|
|
|
|
|
+import com.its.api.its.repository.cctv.TbCctvSttsHsRepository;
|
|
|
|
+import com.its.api.its.repository.vds.TbVdsCtlrSttsHsRepository;
|
|
|
|
+import com.its.api.its.repository.vms.TbVmsSttsHsRepository;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
import java.util.NoSuchElementException;
|
|
import java.util.NoSuchElementException;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -17,31 +20,57 @@ import java.util.NoSuchElementException;
|
|
@Service
|
|
@Service
|
|
public class FcltSttsStatisticsService {
|
|
public class FcltSttsStatisticsService {
|
|
|
|
|
|
- private final FcltSttsStatisticsMapper mapper;
|
|
|
|
|
|
+ private final TbCctvSttsHsRepository cctvSttsHsRepo;
|
|
|
|
+ private final TbVmsSttsHsRepository vmsSttsHsRepo;
|
|
|
|
+ private final TbVdsCtlrSttsHsRepository vdsSttsHsRepo;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 통계 - 시설물 통신단절 통계 - 시설물 구분 목록
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
public List<FcltSttsStatTypeDto> findAllFcltSttsType() {
|
|
public List<FcltSttsStatTypeDto> findAllFcltSttsType() {
|
|
- return this.mapper.findAllFcltSttsType();
|
|
|
|
|
|
+
|
|
|
|
+ List<FcltSttsStatTypeDto> result = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ result.add(FcltSttsStatTypeDto.builder().fcltCd("CCTV").fcltNm("CCTV").build());
|
|
|
|
+ result.add(FcltSttsStatTypeDto.builder().fcltCd("VMS").fcltNm("VMS").build());
|
|
|
|
+ result.add(FcltSttsStatTypeDto.builder().fcltCd("VDS").fcltNm("VDS").build());
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
- public List<FcltSttsStatDto> findAllFcltStts(String FCLT_CD, String fromDt, String toDt) {
|
|
|
|
|
|
+ public List<FcltSttsStatErrorDto> findAllStatisticsCommErrByDateRangeResult(List<FcltSttsStatErrorInf> data) {
|
|
|
|
+
|
|
|
|
+ List<FcltSttsStatErrorDto> result = new ArrayList<>();
|
|
|
|
+ data.forEach(obj -> {
|
|
|
|
+ result.add(FcltSttsStatErrorDto.builder()
|
|
|
|
+ .fcltNmbr(obj.getFcltNmbr())
|
|
|
|
+ .fcltId(obj.getFcltId())
|
|
|
|
+ .fcltNm(obj.getFcltNm())
|
|
|
|
+ .totCnt(obj.getTotCnt().intValue())
|
|
|
|
+ .cms1Cnt(obj.getCms1Cnt().intValue())
|
|
|
|
+ .cms2Cnt(obj.getCms2Cnt().intValue())
|
|
|
|
+ .build());
|
|
|
|
+ });
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
|
- param.put("FROM_DT", fromDt);
|
|
|
|
- param.put("TO_DT", toDt);
|
|
|
|
|
|
+ @Transactional(readOnly = true)
|
|
|
|
+ public List<FcltSttsStatErrorDto> findAllFcltStts(String fcltTypeCd, String fromDt, String toDt) {
|
|
|
|
|
|
- if (("CCTV").equalsIgnoreCase(FCLT_CD)) {
|
|
|
|
- return this.mapper.findAllFcltSttsCCTV(param);
|
|
|
|
|
|
+ if (("CCTV").equalsIgnoreCase(fcltTypeCd)) {
|
|
|
|
+ return findAllStatisticsCommErrByDateRangeResult(this.cctvSttsHsRepo.findAllStatisticsCommErrByDateRange(fromDt, toDt));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- if (("VMS").equalsIgnoreCase(FCLT_CD)) {
|
|
|
|
- return this.mapper.findAllFcltSttsVMS(param);
|
|
|
|
|
|
+ if (("VMS").equalsIgnoreCase(fcltTypeCd)) {
|
|
|
|
+ return findAllStatisticsCommErrByDateRangeResult(this.vmsSttsHsRepo.findAllStatisticsCommErrByDateRange(fromDt, toDt));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
- if (("VDS").equalsIgnoreCase(FCLT_CD)) {
|
|
|
|
- return this.mapper.findAllFcltSttsVDS(param);
|
|
|
|
|
|
+ if (("VDS").equalsIgnoreCase(fcltTypeCd)) {
|
|
|
|
+ return findAllStatisticsCommErrByDateRangeResult(this.vdsSttsHsRepo.findAllStatisticsCommErrByDateRange(fromDt, toDt));
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- throw new NoSuchElementException("요청 파라미터가 잘못 됐습니다: " + FCLT_CD);
|
|
|
|
|
|
+ throw new NoSuchElementException("요청 파라미터가 잘못 됐습니다: " + fcltTypeCd);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|