|
@@ -1,14 +1,19 @@
|
|
package com.its.api.its.service.report;
|
|
package com.its.api.its.service.report;
|
|
|
|
|
|
-import com.its.api.its.model.dto.report.ReportFacilityErrorDto;
|
|
|
|
-import com.its.api.its.model.dto.report.ReportFacilitySummaryDto;
|
|
|
|
-import com.its.api.its.model.dto.report.ReportTrafficCongestDto;
|
|
|
|
-import com.its.api.its.model.dto.report.ReportTrafficIncidentDto;
|
|
|
|
|
|
+import com.its.api.its.model.dto.report.*;
|
|
|
|
+import com.its.api.its.model.entity.cctv.TbCctvSttsHs;
|
|
|
|
+import com.its.api.its.model.entity.vds.TbVdsCtlrSttsHs;
|
|
|
|
+import com.its.api.its.model.entity.vms.TbVmsSttsHs;
|
|
|
|
+import com.its.api.its.repository.cctv.TbCctvSttsHsRepository;
|
|
import com.its.api.its.repository.report.ReportMapper;
|
|
import com.its.api.its.repository.report.ReportMapper;
|
|
|
|
+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.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -19,19 +24,86 @@ import java.util.Map;
|
|
public class ReportService {
|
|
public class ReportService {
|
|
|
|
|
|
private final ReportMapper mapper;
|
|
private final ReportMapper mapper;
|
|
|
|
+ private final TbCctvSttsHsRepository cctvSttsHsRepo;
|
|
|
|
+ private final TbVmsSttsHsRepository vmsSttsHsRepo;
|
|
|
|
+ private final TbVdsCtlrSttsHsRepository vdsSttsHsRepo;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 보고서 - 시설물 보고서 - 시설물 현황
|
|
|
|
+ * @param fromDt
|
|
|
|
+ * @param toDt
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Transactional(readOnly = true)
|
|
public List<ReportFacilitySummaryDto> findAllFacilitySummary(String fromDt, String toDt){
|
|
public List<ReportFacilitySummaryDto> findAllFacilitySummary(String fromDt, String toDt){
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
|
- param.put("FROM_DT", fromDt);
|
|
|
|
- param.put("TO_DT", toDt);
|
|
|
|
- return this.mapper.findAllFacilitySummary(param);
|
|
|
|
|
|
+
|
|
|
|
+ List<ReportFacilitySummaryDto> result = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ ReportFcltSummaryInf cctvSummary = this.cctvSttsHsRepo.findAllReportSummary(fromDt, toDt);
|
|
|
|
+ result.add(ReportFacilitySummaryDto.builder()
|
|
|
|
+ .fcltSeq(1)
|
|
|
|
+ .fcltType("CCTV")
|
|
|
|
+ .cms0Cnt(cctvSummary.getCms0Cnt().intValue())
|
|
|
|
+ .cms1Cnt(cctvSummary.getCms1Cnt().intValue())
|
|
|
|
+ .build());
|
|
|
|
+
|
|
|
|
+ ReportFcltSummaryInf vmsSummary = this.vmsSttsHsRepo.findAllReportSummary(fromDt, toDt);
|
|
|
|
+ result.add(ReportFacilitySummaryDto.builder()
|
|
|
|
+ .fcltSeq(2)
|
|
|
|
+ .fcltType("VMS")
|
|
|
|
+ .cms0Cnt(vmsSummary.getCms0Cnt().intValue())
|
|
|
|
+ .cms1Cnt(vmsSummary.getCms1Cnt().intValue())
|
|
|
|
+ .build());
|
|
|
|
+
|
|
|
|
+ ReportFcltSummaryInf vdsSummary = this.vdsSttsHsRepo.findAllReportSummary(fromDt, toDt);
|
|
|
|
+ result.add(ReportFacilitySummaryDto.builder()
|
|
|
|
+ .fcltSeq(3)
|
|
|
|
+ .fcltType("VDS")
|
|
|
|
+ .cms0Cnt(vdsSummary.getCms0Cnt().intValue())
|
|
|
|
+ .cms1Cnt(vdsSummary.getCms1Cnt().intValue())
|
|
|
|
+ .build());
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
public List<ReportFacilityErrorDto> findAllFacilityError(String fromDt, String toDt){
|
|
public List<ReportFacilityErrorDto> findAllFacilityError(String fromDt, String toDt){
|
|
- Map<String, String> param = new HashMap<>();
|
|
|
|
- param.put("FROM_DT", fromDt);
|
|
|
|
- param.put("TO_DT", toDt);
|
|
|
|
- return this.mapper.findAllFacilityError(param);
|
|
|
|
|
|
+
|
|
|
|
+ List<ReportFacilityErrorDto> result = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ List<TbCctvSttsHs> cctvError = this.cctvSttsHsRepo.findAllReportError(fromDt, toDt);
|
|
|
|
+ cctvError.forEach(obj -> {
|
|
|
|
+ result.add(ReportFacilityErrorDto.builder()
|
|
|
|
+ .fcltSeq(1)
|
|
|
|
+ .fcltType("CCTV")
|
|
|
|
+ .fcltId(obj.getCctv() != null ? obj.getCctv().getCctvCtlrId() : String.valueOf(obj.getCctvMngmNmbr()))
|
|
|
|
+ .fcltNm(obj.getCctv() != null ? obj.getCctv().getIstlLctnNm() : String.valueOf(obj.getCctvMngmNmbr()))
|
|
|
|
+ .rgstDt(obj.getCrtnDt())
|
|
|
|
+ .build());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<TbVmsSttsHs> vmsError = this.vmsSttsHsRepo.findAllReportError(fromDt, toDt);
|
|
|
|
+ vmsError.forEach(obj -> {
|
|
|
|
+ result.add(ReportFacilityErrorDto.builder()
|
|
|
|
+ .fcltSeq(2)
|
|
|
|
+ .fcltType("VMS")
|
|
|
|
+ .fcltId(obj.getVms() != null ? obj.getVms().getVmsCtlrId() : String.valueOf(obj.getVmsCtlrNmbr()))
|
|
|
|
+ .fcltNm(obj.getVms() != null ? obj.getVms().getVmsNm() : String.valueOf(obj.getVmsCtlrNmbr()))
|
|
|
|
+ .rgstDt(obj.getRgstDt()).build());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ List<TbVdsCtlrSttsHs> vdsError = this.vdsSttsHsRepo.findAllReportError(fromDt, toDt);
|
|
|
|
+ vdsError.forEach(obj -> {
|
|
|
|
+ result.add(ReportFacilityErrorDto.builder()
|
|
|
|
+ .fcltSeq(3)
|
|
|
|
+ .fcltType("VDS")
|
|
|
|
+ .fcltId(obj.getVds() != null ? obj.getVds().getVdsCtlrId() : obj.getCtlrMngmNmbr())
|
|
|
|
+ .fcltNm(obj.getVds() != null ? obj.getVds().getLctn() : obj.getCtlrMngmNmbr())
|
|
|
|
+ .rgstDt(obj.getOcrrDt())
|
|
|
|
+ .build());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
public List<ReportTrafficIncidentDto> findAllTrafficIncident(String fromDt, String toDt){
|
|
public List<ReportTrafficIncidentDto> findAllTrafficIncident(String fromDt, String toDt){
|