|
|
@@ -208,55 +208,106 @@ public class MainService {
|
|
|
// }
|
|
|
|
|
|
public List<EvpServiceVo> getEvpServiceList() {
|
|
|
- Map<String, EvpsData> evpDataMap = null;
|
|
|
- List<EvpsData> list = null;
|
|
|
- List<String> keys = null;
|
|
|
- List<EvpServiceVo> result = new ArrayList<>();;
|
|
|
- Map<String, String> regionMap = new HashMap<>();
|
|
|
- if (repo.getEvpDataMap() != null) {
|
|
|
- evpDataMap = repo.getEvpDataMap();
|
|
|
- list = new ArrayList<>(evpDataMap.values());
|
|
|
- keys = new ArrayList<>(evpDataMap.keySet());
|
|
|
- }
|
|
|
- else {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
+ Map<String, EvpsData> evpDataMap = repo.getEvpDataMap();
|
|
|
+ List<EvpServiceVo> result = new ArrayList<>();
|
|
|
+ if (!evpDataMap.isEmpty()) {
|
|
|
+ Map<String, String> regionMap = new HashMap<>();
|
|
|
List<EvpRegionVo> regions = this.mainMapper.getEvpRegion();
|
|
|
-
|
|
|
for (EvpRegionVo vo : regions) {
|
|
|
regionMap.put(vo.getRegionId(), vo.getRegionName());
|
|
|
}
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
|
|
-
|
|
|
- int idx = 0;
|
|
|
- for (EvpsData data : list) {
|
|
|
+ Iterator<Map.Entry<String, EvpsData>> it = evpDataMap.entrySet().iterator();
|
|
|
+ while(it.hasNext()) {
|
|
|
+ Map.Entry<String, EvpsData> entry = it.next();
|
|
|
+ EvpsData data = entry.getValue();
|
|
|
EvpServiceVo vo = data.getEvpServiceVo();
|
|
|
- String clctDt = vo.getClctDt();
|
|
|
- if (clctDt == null || clctDt.equals("")) {
|
|
|
- repo.getEvpDataMap().remove(keys.get(idx));
|
|
|
+ if (vo == null) {
|
|
|
+ it.remove();
|
|
|
continue;
|
|
|
}
|
|
|
- String serviceId = vo.getServiceId().substring(0, 3);
|
|
|
- if (regionMap.size() > 0) {
|
|
|
- vo.setRegionName(regionMap.get(serviceId));
|
|
|
+
|
|
|
+ // clctDt null/empty 체크
|
|
|
+ String clctDt = vo.getClctDt();
|
|
|
+ if (clctDt == null || clctDt.isEmpty()) {
|
|
|
+ it.remove();
|
|
|
+ continue;
|
|
|
}
|
|
|
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
- LocalDateTime targetTime = LocalDateTime.parse(clctDt, formatter);
|
|
|
- LocalDateTime now = LocalDateTime.now();
|
|
|
- long minutesDiff = ChronoUnit.MINUTES.between(targetTime, now);
|
|
|
- if (minutesDiff >= 10) {
|
|
|
- repo.getEvpDataMap().remove(keys.get(idx));
|
|
|
+
|
|
|
+ // 날짜 파싱 오류 대비
|
|
|
+ LocalDateTime targetTime;
|
|
|
+ try {
|
|
|
+ targetTime = LocalDateTime.parse(clctDt, formatter);
|
|
|
+ // 시간 차이 계산
|
|
|
+ long minutesDiff = ChronoUnit.MINUTES.between(targetTime, now);
|
|
|
+ if (minutesDiff >= 10) {
|
|
|
+ it.remove();
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ it.remove();
|
|
|
+ continue;
|
|
|
}
|
|
|
- else {
|
|
|
- result.add(vo);
|
|
|
+
|
|
|
+ result.add(vo);
|
|
|
+ // ServiceId 체크
|
|
|
+ String sid = vo.getServiceId();
|
|
|
+ if (sid == null || sid.length() < 3) {
|
|
|
+ continue;
|
|
|
}
|
|
|
- idx++;
|
|
|
+ String regionKey = sid.substring(0, 3);
|
|
|
+ vo.setRegionName(regionMap.get(regionKey));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
return result;
|
|
|
+
|
|
|
+// List<EvpsData> list = new ArrayList<>(evpDataMap.values());
|
|
|
+// List<String> keys = new ArrayList<>(evpDataMap.keySet());
|
|
|
+// Map<String, String> regionMap = new HashMap<>();
|
|
|
+//
|
|
|
+// if (list.size() > 0) {
|
|
|
+// List<EvpRegionVo> regions = this.mainMapper.getEvpRegion();
|
|
|
+//
|
|
|
+// for (EvpRegionVo vo : regions) {
|
|
|
+// regionMap.put(vo.getRegionId(), vo.getRegionName());
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// int idx = 0;
|
|
|
+// for (EvpsData data : list) {
|
|
|
+// EvpServiceVo vo = data.getEvpServiceVo();
|
|
|
+// String clctDt = vo.getClctDt();
|
|
|
+// if (clctDt == null || clctDt.equals("")) {
|
|
|
+// repo.getEvpDataMap().remove(keys.get(idx));
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// String sid = vo.getServiceId();
|
|
|
+//
|
|
|
+// if (sid != null && sid.length() > 3) {
|
|
|
+// String serviceId = sid.substring(0, 3);
|
|
|
+// if (regionMap.size() > 0 && regionMap.get(serviceId) != null) {
|
|
|
+// vo.setRegionName(regionMap.get(serviceId));
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+// LocalDateTime targetTime = LocalDateTime.parse(clctDt, formatter);
|
|
|
+// LocalDateTime now = LocalDateTime.now();
|
|
|
+// long minutesDiff = ChronoUnit.MINUTES.between(targetTime, now);
|
|
|
+// if (minutesDiff >= 10) {
|
|
|
+// repo.getEvpDataMap().remove(keys.get(idx));
|
|
|
+// }
|
|
|
+// else {
|
|
|
+// result.add(vo);
|
|
|
+// }
|
|
|
+// idx++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// return result;
|
|
|
}
|
|
|
|
|
|
public List<EvpRouteVo> getEvpRouteList(Map<String, Object> paramMap) {
|